v0.9.10
This commit is contained in:
commit
d59ee3834d
297 files changed
+20527
No files matched your search
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace IriksIT\Manager\Console;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use IriksIT\Manager\Support\TwoFactor\Authenticator;
|
||||
|
||||
/**
|
||||
* Takes the second step away from an account that lost its phone and its recovery codes, for the one who cannot log in (the last super admin). The account
|
||||
* sets it up again at its next login; its grace period is not given back.
|
||||
*
|
||||
* php artisan manager:two-factor-reset [email protected]
|
||||
*/
|
||||
class TwoFactorResetCommand extends Command
|
||||
{
|
||||
protected $signature = 'manager:two-factor-reset {email : The email address of the account}';
|
||||
|
||||
protected $description = 'Take the second step of login away from an account that lost its phone';
|
||||
|
||||
public function handle(Authenticator $authenticator): int
|
||||
{
|
||||
$model = config('manager.user_model');
|
||||
$user = $model::query()->where('email', strtolower((string) $this->argument('email')))->first();
|
||||
|
||||
if ($user === null) {
|
||||
$this->error('There is no account with that email address.');
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
$authenticator->reset($user);
|
||||
$authenticator->log('two_factor.reset', 'The second step was reset from the command line', null, $user);
|
||||
$this->info('The second step of '.$user->email.' is off. It sets it up again at the next login.');
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user