Skip to content

Commit

Permalink
Add new way to force remember one-time-password in config
Browse files Browse the repository at this point in the history
  • Loading branch information
maurohmartinez committed May 11, 2022
1 parent 5091323 commit 581bec2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/config/two_factor_auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,20 @@
* Set in days when the one-time-password expires
* 0 means it never expires
*/
'2fa_expires' => 0,
'2fa_expires' => 60,

/*
* Name of checkbox input to remember users in your login form
* This will be used to save a cookie to remember 2FA for that user as well.
* Check carefully "always_remember_one_time_pass" which will override this value.
*/
'remember_input_name' => 'remember',

/*
* If true, we will ignore the "remember me" input and always remember one time password
*/
'always_remember_one_time_pass' => false,

/*
* Name of the route where you want to redirect users after successful validation
*/
Expand Down
2 changes: 1 addition & 1 deletion src/listeners/TwoFactorAuthLoginListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public function handle(): void
{
$remember = Request::get(config('two_factor_auth.remember_input_name'), false);

if ($remember) {
if ($remember || config('two_factor_auth.always_remember_one_time_pass')) {
Session::put(config('two_factor_auth.remember_key'), true);
}
}
Expand Down

0 comments on commit 581bec2

Please sign in to comment.