mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-03 11:08:28 +00:00
Code for #3180
This commit is contained in:
@@ -34,6 +34,20 @@ use Preferences;
|
|||||||
*/
|
*/
|
||||||
class TwoFactorController extends Controller
|
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
|
* @param Request $request
|
||||||
*
|
*
|
||||||
@@ -118,27 +132,6 @@ class TwoFactorController extends Controller
|
|||||||
Preferences::set('mfa_history', $newHistory);
|
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
|
* 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.
|
* submitted MFA code has been submitted in the last 5 minutes, it won't work despite being valid.
|
||||||
|
@@ -95,7 +95,7 @@ return [
|
|||||||
'two_factor_forgot' => 'I forgot my two-factor thing.',
|
'two_factor_forgot' => 'I forgot my two-factor thing.',
|
||||||
'two_factor_lost_header' => 'Lost your two factor authentication?',
|
'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_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 <container_id></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.',
|
'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.',
|
'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',
|
'pref_two_factor_new_backup_codes' => 'Get new backup codes',
|
||||||
|
Reference in New Issue
Block a user