mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-02-23 05:41:05 +01:00
Set Imports IDs from constants
This commit is contained in:
parent
e5c21d1189
commit
5c35f815ba
@ -50,6 +50,9 @@ class TwoFAccount extends Model implements Sortable
|
||||
const DEFAULT_DIGITS = 6;
|
||||
const DEFAULT_ALGORITHM = self::SHA1;
|
||||
|
||||
const DUPLICATE_ID = -1;
|
||||
const FAKE_ID = -2;
|
||||
|
||||
private const IMAGELINK_STORAGE_PATH = 'imagesLink/';
|
||||
|
||||
/**
|
||||
|
@ -10,6 +10,7 @@
|
||||
use App\Exceptions\InvalidMigrationDataException;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Helpers\Helpers;
|
||||
use App\Facades\TwoFAccounts;
|
||||
|
||||
class AegisMigrator extends Migrator
|
||||
{
|
||||
@ -106,7 +107,7 @@ public function migrate(mixed $migrationPayload) : Collection
|
||||
|
||||
// The token failed to generate a valid account so we create a fake account to be returned.
|
||||
$fakeAccount = new TwoFAccount();
|
||||
$fakeAccount->id = -2;
|
||||
$fakeAccount->id = TwoFAccount::FAKE_ID;
|
||||
$fakeAccount->otp_type = $otp_parameters['type'];
|
||||
// Only basic fields are filled to limit the risk of another exception.
|
||||
$fakeAccount->account = $otp_parameters['name'];
|
||||
|
@ -101,7 +101,7 @@ private static function markAsDuplicate(Collection $twofaccounts) : Collection
|
||||
&& $value->digits == $twofaccount->digits
|
||||
&& $value->algorithm == $twofaccount->algorithm;
|
||||
})) {
|
||||
$twofaccount->id = -1;
|
||||
$twofaccount->id = TwoFAccount::DUPLICATE_ID;
|
||||
}
|
||||
|
||||
return $twofaccount;
|
||||
|
Loading…
Reference in New Issue
Block a user