3 namespace BookStack\Http\Controllers\Auth;
5 use BookStack\Actions\ActivityType;
6 use BookStack\Auth\Access\Mfa\MfaValue;
7 use BookStack\Http\Controllers\Controller;
9 class MfaController extends Controller
12 * Show the view to setup MFA for the current user.
14 public function setup()
16 $userMethods = user()->mfaValues()
17 ->get(['id', 'method'])
19 return view('mfa.setup', [
20 'userMethods' => $userMethods,
25 * Remove an MFA method for the current user.
28 public function remove(string $method)
30 if (in_array($method, MfaValue::allMethods())) {
31 $value = user()->mfaValues()->where('method', '=', $method)->first();
34 $this->logActivity(ActivityType::MFA_REMOVE_METHOD, $method);
38 return redirect('/mfa/setup');
42 * Show the page to start an MFA verification.
44 public function verify()
46 $userMethods = user()->mfaValues()
47 ->get(['id', 'method'])
50 return view('mfa.verify', [
51 'userMethods' => $userMethods,