mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-08-26 04:05:57 +00:00
Cleaned some unused elements during testing
This commit is contained in:
parent
78e94bb003
commit
2d306949b5
@ -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
|
* Will return a JSON string containing the codes.
|
||||||
* the codes.
|
|
||||||
*/
|
*/
|
||||||
public function removeInputCodeFromSet(string $code, string $codeSet): ?string
|
public function removeInputCodeFromSet(string $code, string $codeSet): string
|
||||||
{
|
{
|
||||||
$cleanCode = $this->cleanInputCode($code);
|
$cleanCode = $this->cleanInputCode($code);
|
||||||
$codes = json_decode($codeSet);
|
$codes = json_decode($codeSet);
|
||||||
$pos = array_search($cleanCode, $codes, true);
|
$pos = array_search($cleanCode, $codes, true);
|
||||||
array_splice($codes, $pos, 1);
|
array_splice($codes, $pos, 1);
|
||||||
|
|
||||||
if (count($codes) === 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return json_encode($codes);
|
return json_encode($codes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user