Clean up code.

This commit is contained in:
James Cole
2023-12-10 06:51:59 +01:00
parent c2b22a2bac
commit 46e130fdfe
195 changed files with 973 additions and 984 deletions

View File

@@ -170,7 +170,7 @@ class TwoFactorController extends Controller
private function isBackupCode(string $mfaCode): bool
{
$list = app('preferences')->get('mfa_recovery', [])->data;
if(!is_array($list)) {
if (!is_array($list)) {
$list = [];
}
if (in_array($mfaCode, $list, true)) {
@@ -187,8 +187,8 @@ class TwoFactorController extends Controller
*/
private function removeFromBackupCodes(string $mfaCode): void
{
$list = app('preferences')->get('mfa_recovery', [])->data;
if(!is_array($list)) {
$list = app('preferences')->get('mfa_recovery', [])->data;
if (!is_array($list)) {
$list = [];
}
$newList = array_values(array_diff($list, [$mfaCode]));