This commit is contained in:
James Cole
2020-03-10 18:29:27 +01:00
parent 086e4d5880
commit 774f7d88c2
2 changed files with 15 additions and 22 deletions

View File

@@ -34,6 +34,20 @@ use Preferences;
*/
class TwoFactorController extends Controller
{
/**
* What to do if 2FA lost?
*
* @return mixed
*/
public function lostTwoFactor()
{
/** @var User $user */
$user = auth()->user();
$siteOwner = config('firefly.site_owner');
$title = (string)trans('firefly.two_factor_forgot_title');
return view('auth.lost-two-factor', compact('user', 'siteOwner', 'title'));
}
/**
* @param Request $request
*
@@ -118,27 +132,6 @@ class TwoFactorController extends Controller
Preferences::set('mfa_history', $newHistory);
}
/**
* What to do if 2FA lost?
*
* @return mixed
*/
public function lostTwoFactor()
{
/** @var User $user */
$user = auth()->user();
$siteOwner = config('firefly.site_owner');
$title = (string)trans('firefly.two_factor_forgot_title');
Log::info(
'To reset the two factor authentication for user #' . $user->id .
' (' . $user->email . '), simply open the "preferences" table and delete the entries with the names "twoFactorAuthEnabled" and' .
' "twoFactorAuthSecret" for user_id ' . $user->id . '. That will take care of it.'
);
return view('auth.lost-two-factor', compact('user', 'siteOwner', 'title'));
}
/**
* Each MFA history has a timestamp and a code, saving the MFA entries for 5 minutes. So if the
* submitted MFA code has been submitted in the last 5 minutes, it won't work despite being valid.