Expand some code for Spectre import.

This commit is contained in:
James Cole
2018-01-10 16:49:32 +01:00
parent 2e495c38d1
commit 87dae6ea18
5 changed files with 81 additions and 30 deletions

View File

@@ -130,6 +130,7 @@ class SpectreConfigurator implements ConfiguratorInterface
switch ($stage) {
case 'has-token':
// redirect to Spectre.
Log::info('User is being redirected to Spectre.');
return 'import.spectre.redirect';
break;
case 'have-accounts':

View File

@@ -315,7 +315,12 @@ class SpectreRoutine implements RoutineInterface
}
}
if (is_null($final)) {
throw new FireflyException('No valid login attempt found.');
Log::error('Could not find a valid login for this user.');
$this->repository->addError($this->job, 0, 'Spectre connection failed. Did you use invalid credentials, press Cancel or failed the 2FA challenge?');
$this->repository->setTotalSteps($this->job, 1);
$this->repository->setStepsDone($this->job, 1);
$this->repository->setStatus($this->job,'error');
return;
}
// add some steps done
@@ -457,6 +462,7 @@ class SpectreRoutine implements RoutineInterface
// update job:
$this->job->status = 'finished';
$this->job->save();
return;
}