]> BookStack Code Mirror - bookstack/commitdiff
Cleaned some unused elements during testing 2827/head
authorDan Brown <redacted>
Sat, 21 Aug 2021 14:38:43 +0000 (15:38 +0100)
committerDan Brown <redacted>
Sat, 21 Aug 2021 14:38:43 +0000 (15:38 +0100)
app/Auth/Access/Mfa/BackupCodeService.php
app/Auth/Access/Mfa/MfaValue.php

index 6fbbf64b5d8b50cab078d688f03d7f4485b26c9c..ca58e740486ca1342475c9fee6ef1c614c55eb8a 100644 (file)
@@ -34,20 +34,14 @@ class BackupCodeService
 
     /**
      * Remove the given input code from the given available options.
 
     /**
      * Remove the given input code from the given available options.
-     * Will return null if no codes remain otherwise will be a JSON string to contain
-     * the codes.
+     * Will return a JSON string containing the codes.
      */
      */
-    public function removeInputCodeFromSet(string $code, string $codeSet): ?string
+    public function removeInputCodeFromSet(string $code, string $codeSet): string
     {
         $cleanCode = $this->cleanInputCode($code);
         $codes = json_decode($codeSet);
         $pos = array_search($cleanCode, $codes, true);
         array_splice($codes, $pos, 1);
     {
         $cleanCode = $this->cleanInputCode($code);
         $codes = json_decode($codeSet);
         $pos = array_search($cleanCode, $codes, true);
         array_splice($codes, $pos, 1);
-
-        if (count($codes) === 0) {
-            return null;
-        }
-
         return json_encode($codes);
     }
 
         return json_encode($codes);
     }
 
index 228a6d43f917ad9bdd9e3335bdbadd58250cccad..ec0d5d563fea7b49b60aaa7cc4ff8e99f4e0e665 100644 (file)
@@ -58,17 +58,6 @@ class MfaValue extends Model
         return $mfaVal ? $mfaVal->getValue() : null;
     }
 
         return $mfaVal ? $mfaVal->getValue() : null;
     }
 
-    /**
-     * Delete any stored MFA values for the given user and method.
-     */
-    public static function deleteValuesForUser(User $user, string $method): void
-    {
-        static::query()
-            ->where('user_id', '=', $user->id)
-            ->where('method', '=', $method)
-            ->delete();
-    }
-
     /**
      * Decrypt the value attribute upon access.
      */
     /**
      * Decrypt the value attribute upon access.
      */