mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 06:24:44 +02:00
Remove recovery token repository
This commit is contained in:
parent
a496be67b8
commit
191e0adc58
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Eloquent;
|
||||
|
||||
use App\Models\RecoveryToken;
|
||||
|
||||
class RecoveryTokenRepository extends EloquentRepository
|
||||
{
|
||||
public function model(): string
|
||||
{
|
||||
return RecoveryToken::class;
|
||||
}
|
||||
}
|
@ -2,13 +2,13 @@
|
||||
|
||||
namespace App\Services\Users;
|
||||
|
||||
use App\Models\RecoveryToken;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\User;
|
||||
use PragmaRX\Google2FA\Google2FA;
|
||||
use Illuminate\Database\ConnectionInterface;
|
||||
use Illuminate\Contracts\Encryption\Encrypter;
|
||||
use App\Repositories\Eloquent\RecoveryTokenRepository;
|
||||
use App\Exceptions\Service\User\TwoFactorAuthenticationTokenInvalid;
|
||||
|
||||
class ToggleTwoFactorService
|
||||
@ -20,7 +20,6 @@ class ToggleTwoFactorService
|
||||
private ConnectionInterface $connection,
|
||||
private Encrypter $encrypter,
|
||||
private Google2FA $google2FA,
|
||||
private RecoveryTokenRepository $recoveryTokenRepository,
|
||||
) {
|
||||
}
|
||||
|
||||
@ -68,12 +67,12 @@ class ToggleTwoFactorService
|
||||
$tokens[] = $token;
|
||||
}
|
||||
|
||||
// Before inserting any new records make sure all of the old ones are deleted to avoid
|
||||
// Before inserting any new records make sure all the old ones are deleted to avoid
|
||||
// any issues or storing an unnecessary number of tokens in the database.
|
||||
$this->recoveryTokenRepository->deleteWhere(['user_id' => $user->id]);
|
||||
$user->recoveryTokens()->delete();
|
||||
|
||||
// Bulk insert the hashed tokens.
|
||||
$this->recoveryTokenRepository->insert($inserts);
|
||||
RecoveryToken::query()->insert($inserts);
|
||||
}
|
||||
|
||||
$user->totp_authenticated_at = now();
|
||||
|
Loading…
x
Reference in New Issue
Block a user