3 namespace BookStack\Console\Commands;
6 use Illuminate\Console\Command;
8 class ResetMfaCommand extends Command
10 use HandlesSingleUser;
13 * The name and signature of the console command.
17 protected $signature = 'bookstack:reset-mfa
18 {--id= : Numeric ID of the user to reset MFA for}
19 {--email= : Email address of the user to reset MFA for}
23 * The console command description.
27 protected $description = 'Reset & Clear any configured MFA methods for the given user';
30 * Execute the console command.
32 public function handle(): int
35 $user = $this->fetchProvidedUser();
36 } catch (Exception $exception) {
37 $this->error($exception->getMessage());
41 $this->info("This will delete any configure multi-factor authentication methods for user: \n- ID: {$user->id}\n- Name: {$user->name}\n- Email: {$user->email}\n");
42 $this->info('If multi-factor authentication is required for this user they will be asked to reconfigure their methods on next login.');
43 $confirm = $this->confirm('Are you sure you want to proceed?');
48 $user->mfaValues()->delete();
49 $this->info('User MFA methods have been reset.');