Add translations for 2FA controllers and actions
This commit is contained in:
parent
e6ff2e444d
commit
075614c5d7
|
@ -16,7 +16,7 @@ class User::SessionsController < Devise::SessionsController
|
|||
session[:user_sign_in_uid] = resource.id
|
||||
sign_out(resource)
|
||||
warden.lock!
|
||||
render 'auth/two_factor_authentication'
|
||||
render "auth/two_factor_authentication"
|
||||
else
|
||||
if params[:user][:otp_attempt].length == 8
|
||||
found = TotpRecoveryCode.where(user_id: resource.id, code: params[:user][:otp_attempt].downcase).delete_all
|
||||
|
@ -24,14 +24,14 @@ class User::SessionsController < Devise::SessionsController
|
|||
flash[:info] = "You have #{TotpRecoveryCode.where(user_id: resource.id).count} recovery codes remaining."
|
||||
continue_sign_in(resource, resource_name)
|
||||
else
|
||||
flash[:error] = t('views.auth.2fa.errors.invalid_code')
|
||||
flash[:error] = t(".error")
|
||||
redirect_to new_user_session_url
|
||||
end
|
||||
elsif resource.authenticate_otp(params[:user][:otp_attempt], drift: APP_CONFIG.fetch(:otp_drift_period, 30).to_i)
|
||||
continue_sign_in(resource, resource_name)
|
||||
else
|
||||
sign_out(resource)
|
||||
flash[:error] = t('views.auth.2fa.errors.invalid_code')
|
||||
flash[:error] = t(".error")
|
||||
redirect_to new_user_session_url
|
||||
end
|
||||
end
|
||||
|
|
|
@ -192,7 +192,7 @@ class UserController < ApplicationController
|
|||
|
||||
qr_code = RQRCode::QRCode.new(current_user.provisioning_uri("Retrospring:#{current_user.screen_name}", issuer: "Retrospring"))
|
||||
|
||||
@qr_svg = qr_code.as_svg({offset: 4, module_size: 4, color: '000;fill:var(--primary)'}).html_safe
|
||||
@qr_svg = qr_code.as_svg({offset: 4, module_size: 4, color: "000;fill:var(--primary)"}).html_safe
|
||||
else
|
||||
@recovery_code_count = current_user.totp_recovery_codes.count
|
||||
end
|
||||
|
@ -206,9 +206,9 @@ class UserController < ApplicationController
|
|||
@recovery_keys = TotpRecoveryCode.generate_for(current_user)
|
||||
current_user.save!
|
||||
|
||||
render 'settings/security/recovery_keys'
|
||||
render "settings/security/recovery_keys"
|
||||
else
|
||||
flash[:error] = t('views.auth.2fa.errors.invalid_code')
|
||||
flash[:error] = t(".error")
|
||||
redirect_to edit_user_security_path
|
||||
end
|
||||
end
|
||||
|
@ -217,7 +217,7 @@ class UserController < ApplicationController
|
|||
current_user.otp_module = :disabled
|
||||
current_user.save!
|
||||
current_user.totp_recovery_codes.delete_all
|
||||
flash[:success] = 'Two factor authentication has been disabled for your account.'
|
||||
flash[:success] = t(".success")
|
||||
redirect_to edit_user_security_path
|
||||
end
|
||||
|
||||
|
|
|
@ -33,9 +33,16 @@ en:
|
|||
notice:
|
||||
profile_picture: " It might take a few minutes until your new profile picture is shown everywhere."
|
||||
profile_header: " It might take a few minutes until your new profile header is shown everywhere."
|
||||
update_2fa:
|
||||
error: :errors.invalid_otp
|
||||
destroy_2fa:
|
||||
success: "Two factor authentication has been disabled for your account."
|
||||
update_profile:
|
||||
success: :user.update.success
|
||||
error: :user.update.error
|
||||
update_theme:
|
||||
success: "Theme saved successfully."
|
||||
error: "Theme saving failed. %{errors}"
|
||||
sessions:
|
||||
create:
|
||||
error: :errors.invalid_otp
|
||||
|
|
Loading…
Reference in New Issue