mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-01-31 13:49:06 +01:00
Use the same string for 2FA failures
This commit is contained in:
parent
d7a1750694
commit
66cccbb5d6
3 changed files with 7 additions and 3 deletions
|
@ -22,7 +22,7 @@ class User::SessionsController < Devise::SessionsController
|
||||||
continue_sign_in(resource, resource_name)
|
continue_sign_in(resource, resource_name)
|
||||||
else
|
else
|
||||||
sign_out(resource)
|
sign_out(resource)
|
||||||
flash[:error] = "Invalid code provided"
|
flash[:error] = t('views.auth.2fa.errors.invalid_code')
|
||||||
redirect_to new_user_session_url
|
redirect_to new_user_session_url
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -190,10 +190,10 @@ class UserController < ApplicationController
|
||||||
current_user.otp_module = :enabled
|
current_user.otp_module = :enabled
|
||||||
|
|
||||||
if current_user.authenticate_otp(req_params[:otp_validation])
|
if current_user.authenticate_otp(req_params[:otp_validation])
|
||||||
flash[:success] = 'Two factor authentication has been enabled for your account.'
|
flash[:success] = I18n.t('views.auth.2fa.setup.success')
|
||||||
current_user.save!
|
current_user.save!
|
||||||
else
|
else
|
||||||
flash[:error] = 'The code you entered was invalid.'
|
flash[:error] = t('views.auth.2fa.errors.invalid_code')
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_to edit_user_security_path
|
redirect_to edit_user_security_path
|
||||||
|
|
|
@ -452,3 +452,7 @@ en:
|
||||||
2fa:
|
2fa:
|
||||||
title: "Two-factor authentication"
|
title: "Two-factor authentication"
|
||||||
otp_field: "One-time password"
|
otp_field: "One-time password"
|
||||||
|
errors:
|
||||||
|
invalid_code: ""
|
||||||
|
setup:
|
||||||
|
success: "Two factor authentication has been enabled for your account."
|
||||||
|
|
Loading…
Reference in a new issue