This commit is contained in:
James Cole 2020-03-10 18:29:27 +01:00
parent 086e4d5880
commit 774f7d88c2
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
2 changed files with 15 additions and 22 deletions
app/Http/Controllers/Auth
resources/lang/en_US

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.

View File

@ -95,7 +95,7 @@ return [
'two_factor_forgot' => 'I forgot my two-factor thing.',
'two_factor_lost_header' => 'Lost your two factor authentication?',
'two_factor_lost_intro' => 'If you lost your backup codes as well, you have bad luck. This is not something you can fix from the web interface. You have two choices.',
'two_factor_lost_fix_self' => 'If you run your own instance of Firefly III, check the logs in <code>storage/logs</code> for instructions, or run <code>docker logs &lt;container_id&gt;</code> to see the instructions (refresh this page).',
'two_factor_lost_fix_self' => 'If you run your own instance of Firefly III, read <a href="https://docs.firefly-iii.org/faq/other#i-lost-my-two-factor-authentication-codes-and-backup-codes">this entry in the FAQ</a> for instructions.',
'two_factor_lost_fix_owner' => 'Otherwise, email the site owner, <a href="mailto::site_owner">:site_owner</a> and ask them to reset your two factor authentication.',
'mfa_backup_code' => 'You have used a backup code to login to Firefly III. It can\'t be used again, so cross it from your list.',
'pref_two_factor_new_backup_codes' => 'Get new backup codes',