mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-26 15:01:54 +02: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_DIGITS = 6;
|
||||||
const DEFAULT_ALGORITHM = self::SHA1;
|
const DEFAULT_ALGORITHM = self::SHA1;
|
||||||
|
|
||||||
|
const DUPLICATE_ID = -1;
|
||||||
|
const FAKE_ID = -2;
|
||||||
|
|
||||||
private const IMAGELINK_STORAGE_PATH = 'imagesLink/';
|
private const IMAGELINK_STORAGE_PATH = 'imagesLink/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,6 +10,7 @@ use Illuminate\Support\Arr;
|
|||||||
use App\Exceptions\InvalidMigrationDataException;
|
use App\Exceptions\InvalidMigrationDataException;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use App\Helpers\Helpers;
|
use App\Helpers\Helpers;
|
||||||
|
use App\Facades\TwoFAccounts;
|
||||||
|
|
||||||
class AegisMigrator extends Migrator
|
class AegisMigrator extends Migrator
|
||||||
{
|
{
|
||||||
@ -106,7 +107,7 @@ class AegisMigrator extends Migrator
|
|||||||
|
|
||||||
// The token failed to generate a valid account so we create a fake account to be returned.
|
// The token failed to generate a valid account so we create a fake account to be returned.
|
||||||
$fakeAccount = new TwoFAccount();
|
$fakeAccount = new TwoFAccount();
|
||||||
$fakeAccount->id = -2;
|
$fakeAccount->id = TwoFAccount::FAKE_ID;
|
||||||
$fakeAccount->otp_type = $otp_parameters['type'];
|
$fakeAccount->otp_type = $otp_parameters['type'];
|
||||||
// Only basic fields are filled to limit the risk of another exception.
|
// Only basic fields are filled to limit the risk of another exception.
|
||||||
$fakeAccount->account = $otp_parameters['name'];
|
$fakeAccount->account = $otp_parameters['name'];
|
||||||
|
@ -101,7 +101,7 @@ class TwoFAccountService
|
|||||||
&& $value->digits == $twofaccount->digits
|
&& $value->digits == $twofaccount->digits
|
||||||
&& $value->algorithm == $twofaccount->algorithm;
|
&& $value->algorithm == $twofaccount->algorithm;
|
||||||
})) {
|
})) {
|
||||||
$twofaccount->id = -1;
|
$twofaccount->id = TwoFAccount::DUPLICATE_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $twofaccount;
|
return $twofaccount;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user