mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Add MFA code in prep of new MFA routine
This commit is contained in:
@@ -285,6 +285,8 @@ class UserRepository implements UserRepositoryInterface
|
||||
*/
|
||||
public function hasRole(User $user, string $role): bool
|
||||
{
|
||||
// TODO no longer need to loop like this
|
||||
|
||||
/** @var Role $userRole */
|
||||
foreach ($user->roles as $userRole) {
|
||||
if ($userRole->name === $role) {
|
||||
@@ -371,4 +373,16 @@ class UserRepository implements UserRepositoryInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set MFA code.
|
||||
*
|
||||
* @param User $user
|
||||
* @param string $code
|
||||
*/
|
||||
public function setMFACode(User $user, string $code): void
|
||||
{
|
||||
$user->mfa_secret = $code;
|
||||
$user->save();
|
||||
}
|
||||
}
|
||||
|
@@ -39,6 +39,14 @@ interface UserRepositoryInterface
|
||||
*/
|
||||
public function all(): Collection;
|
||||
|
||||
/**
|
||||
* Set MFA code.
|
||||
*
|
||||
* @param User $user
|
||||
* @param string $code
|
||||
*/
|
||||
public function setMFACode(User $user, string $code): void;
|
||||
|
||||
/**
|
||||
* Gives a user a role.
|
||||
*
|
||||
|
@@ -62,6 +62,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @property bool $has2FA used in admin user controller.
|
||||
* @property array $prefs used in admin user controller.
|
||||
* @property string password
|
||||
* @property string $mfa_secret
|
||||
* @property Collection roles
|
||||
* @property string blocked_code
|
||||
* @property bool blocked
|
||||
|
Reference in New Issue
Block a user