Use the same string for 2FA failures

This commit is contained in:
Dominik Kwiatek 2020-10-23 20:58:42 +02:00
parent d7a1750694
commit 66cccbb5d6
3 changed files with 7 additions and 3 deletions

View File

@ -22,7 +22,7 @@ class User::SessionsController < Devise::SessionsController
continue_sign_in(resource, resource_name)
else
sign_out(resource)
flash[:error] = "Invalid code provided"
flash[:error] = t('views.auth.2fa.errors.invalid_code')
redirect_to new_user_session_url
end
end

View File

@ -190,10 +190,10 @@ class UserController < ApplicationController
current_user.otp_module = :enabled
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!
else
flash[:error] = 'The code you entered was invalid.'
flash[:error] = t('views.auth.2fa.errors.invalid_code')
end
redirect_to edit_user_security_path

View File

@ -452,3 +452,7 @@ en:
2fa:
title: "Two-factor authentication"
otp_field: "One-time password"
errors:
invalid_code: ""
setup:
success: "Two factor authentication has been enabled for your account."