mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Refactor tests and code to handle new 2FA methods.
This commit is contained in:
@@ -245,21 +245,14 @@ class UserRepository implements UserRepositoryInterface
|
||||
$return = [];
|
||||
|
||||
// two factor:
|
||||
die('this method references 2FA and must be refactored.');
|
||||
$is2faEnabled = app('preferences')->getForUser($user, 'twoFactorAuthEnabled', false)->data;
|
||||
$has2faSecret = null !== app('preferences')->getForUser($user, 'twoFactorAuthSecret');
|
||||
$return['has_2fa'] = false;
|
||||
if ($is2faEnabled && $has2faSecret) {
|
||||
$return['has_2fa'] = true;
|
||||
}
|
||||
|
||||
$return['is_admin'] = $this->hasRole($user, 'owner');
|
||||
$return['blocked'] = 1 === (int)$user->blocked;
|
||||
$return['blocked_code'] = $user->blocked_code;
|
||||
$return['accounts'] = $user->accounts()->count();
|
||||
$return['journals'] = $user->transactionJournals()->count();
|
||||
$return['transactions'] = $user->transactions()->count();
|
||||
$return['attachments'] = $user->attachments()->count();
|
||||
$return['has_2fa'] = $user->mfa_secret !== null;
|
||||
$return['is_admin'] = $this->hasRole($user, 'owner');
|
||||
$return['blocked'] = 1 === (int)$user->blocked;
|
||||
$return['blocked_code'] = $user->blocked_code;
|
||||
$return['accounts'] = $user->accounts()->count();
|
||||
$return['journals'] = $user->transactionJournals()->count();
|
||||
$return['transactions'] = $user->transactions()->count();
|
||||
$return['attachments'] = $user->attachments()->count();
|
||||
$return['attachments_size'] = $user->attachments()->sum('size');
|
||||
$return['bills'] = $user->bills()->count();
|
||||
$return['categories'] = $user->categories()->count();
|
||||
|
Reference in New Issue
Block a user