Add info flash translation for used recovery key

This commit is contained in:
Andreas Nedbal 2022-02-13 19:20:20 +01:00 committed by Andreas Nedbal
parent 04d650a85a
commit 9899f05560
2 changed files with 2 additions and 1 deletions

View File

@ -21,7 +21,7 @@ class User::SessionsController < Devise::SessionsController
if params[:user][:otp_attempt].length == 8
found = TotpRecoveryCode.where(user_id: resource.id, code: params[:user][:otp_attempt].downcase).delete_all
if found == 1
flash[:info] = "You have #{TotpRecoveryCode.where(user_id: resource.id).count} recovery codes remaining."
flash[:info] = t(".info", count: TotpRecoveryCode.where(user_id: resource.id).count)
continue_sign_in(resource, resource_name)
else
flash[:error] = t(".error")

View File

@ -45,4 +45,5 @@ en:
error: "Theme saving failed. %{errors}"
sessions:
create:
info: "You have %{count} recovery codes remaining."
error: :errors.invalid_otp