]> BookStack Code Mirror - bookstack/blobdiff - app/Http/Controllers/Auth/MfaController.php
Fixed failing test after drawio default url change
[bookstack] / app / Http / Controllers / Auth / MfaController.php
index 6d868b6f3473400c7505c2675f5ab157ef3b2d21..6f6beb873e4911c6a509450694550edbe98cc953 100644 (file)
@@ -5,7 +5,7 @@ namespace BookStack\Http\Controllers\Auth;
 use BookStack\Actions\ActivityType;
 use BookStack\Auth\Access\Mfa\MfaValue;
 use BookStack\Http\Controllers\Controller;
-use BookStack\Http\Request;
+use Illuminate\Http\Request;
 
 class MfaController extends Controller
 {
@@ -20,6 +20,9 @@ class MfaController extends Controller
             ->mfaValues()
             ->get(['id', 'method'])
             ->groupBy('method');
+
+        $this->setPageTitle(trans('auth.mfa_setup'));
+
         return view('mfa.setup', [
             'userMethods' => $userMethods,
         ]);
@@ -27,6 +30,7 @@ class MfaController extends Controller
 
     /**
      * Remove an MFA method for the current user.
+     *
      * @throws \Exception
      */
     public function remove(string $method)
@@ -47,7 +51,6 @@ class MfaController extends Controller
      */
     public function verify(Request $request)
     {
-        // TODO - Test this
         $desiredMethod = $request->get('method');
         $userMethods = $this->currentOrLastAttemptedUser()
             ->mfaValues()
@@ -57,13 +60,13 @@ class MfaController extends Controller
         // Basic search for the default option for a user.
         // (Prioritises totp over backup codes)
         $method = $userMethods->has($desiredMethod) ? $desiredMethod : $userMethods->keys()->sort()->reverse()->first();
-        $otherMethods = $userMethods->keys()->filter(function($userMethod) use ($method) {
+        $otherMethods = $userMethods->keys()->filter(function ($userMethod) use ($method) {
             return $method !== $userMethod;
         })->all();
 
         return view('mfa.verify', [
-            'userMethods' => $userMethods,
-            'method' => $method,
+            'userMethods'  => $userMethods,
+            'method'       => $method,
             'otherMethods' => $otherMethods,
         ]);
     }