diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 9cc74bc7df..ac19a57a72 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -427,10 +427,6 @@ class LoginController extends Controller return redirect()->route('two-factor')->with('error', trans('auth/message.two_factor.code_required')); } - if (! $request->has('two_factor_secret')) { // TODO this seems almost the same as above? - return redirect()->route('two-factor')->with('error', trans('auth/message.two_factor.code_required')); - } - $user = Auth::user(); $secret = $request->input('two_factor_secret'); @@ -537,7 +533,7 @@ class LoginController extends Controller $minutes = round($seconds / 60); - $message = \Lang::get('auth/message.throttle', ['minutes' => $minutes]); + $message = trans('auth/message.throttle', ['minutes' => $minutes]); return redirect()->back() ->withInput($request->only($this->username(), 'remember')) diff --git a/app/Http/Middleware/CheckForTwoFactor.php b/app/Http/Middleware/CheckForTwoFactor.php index 15e84217e9..7846d00ade 100644 --- a/app/Http/Middleware/CheckForTwoFactor.php +++ b/app/Http/Middleware/CheckForTwoFactor.php @@ -49,10 +49,10 @@ class CheckForTwoFactor // Otherwise make sure they're enrolled and show them the 2FA code screen if ((Auth::user()->two_factor_secret != '') && (Auth::user()->two_factor_enrolled == '1')) { - return redirect()->route('two-factor')->with('info', trans('auth/general.two_factor_code')); + return redirect()->route('two-factor')->with('info', trans('auth/message.two_factor.enter_two_factor_code')); } - return redirect()->route('two-factor-enroll')->with('success', 'Please enroll a device in two-factor authentication.'); + return redirect()->route('two-factor-enroll')->with('success', trans('auth/message.two_factor.please_enroll')); } } diff --git a/resources/lang/en-US/auth/general.php b/resources/lang/en-US/auth/general.php index f54e7e2ba0..2bbd112788 100644 --- a/resources/lang/en-US/auth/general.php +++ b/resources/lang/en-US/auth/general.php @@ -14,6 +14,5 @@ return [ 'username_help_bottom' => 'Your username and email address may be the same, but may not be, depending on your configuration. If you cannot remember your username, contact your administrator.

Usernames without an associated email address will not be emailed a password reset link. ', 'google_login' => 'Login with Google Workspace', 'google_login_failed' => 'Google Login failed, please try again.', - 'two_factor_code' => 'Please enter your two-factor authentication code.', ]; diff --git a/resources/lang/en-US/auth/message.php b/resources/lang/en-US/auth/message.php index f086d8c04c..588c9069ca 100644 --- a/resources/lang/en-US/auth/message.php +++ b/resources/lang/en-US/auth/message.php @@ -14,6 +14,8 @@ return array( 'success' => 'You have successfully logged in.', 'code_required' => 'Two-factor code is required.', 'invalid_code' => 'Two-factor code is invalid.', + 'enter_two_factor_code' => 'Please enter your two-factor authentication code.', + 'please_enroll' => 'Please enroll a device in two-factor authentication.', ), 'signin' => array(