adds validation error for letter verification code [#395]
This commit is contained in:
@@ -22,6 +22,18 @@ class Verification::Letter
|
||||
end
|
||||
|
||||
def verify?
|
||||
letter_sent?
|
||||
correct_code?
|
||||
errors.blank?
|
||||
end
|
||||
|
||||
def letter_sent?
|
||||
errors.add(:verification_code, I18n.t('verification.letter.errors.letter_not_sent')) unless
|
||||
user.letter_sent_at.present?
|
||||
end
|
||||
|
||||
def correct_code?
|
||||
errors.add(:verification_code, I18n.t('verification.letter.errors.incorect_code')) unless
|
||||
user.letter_verification_code == verification_code
|
||||
end
|
||||
|
||||
|
||||
@@ -78,12 +78,15 @@ en:
|
||||
title: "Security code confirmation"
|
||||
confirmation_code: "Enter the security code in your letter"
|
||||
update:
|
||||
error: "Incorrect confirmation code"
|
||||
flash:
|
||||
success: "Correct code. Your account is verified"
|
||||
alert:
|
||||
unconfirmed_code: "You have not yet enter the confirmation code"
|
||||
verify_attemps_left: "You have reached the maximum number of letter verification tries"
|
||||
errors:
|
||||
letter_not_sent: "We have not sent you the letter with the code yet"
|
||||
incorect_code: "Incorrect confirmation code"
|
||||
address_not_found: "Address not found"
|
||||
verified_user:
|
||||
show:
|
||||
title: "Available information"
|
||||
|
||||
@@ -78,12 +78,18 @@ es:
|
||||
title: "Confirmación de código de seguridad"
|
||||
confirmation_code: "Introduce el código que has recibido en tu carta"
|
||||
update:
|
||||
error: "Código de verificación incorrecto"
|
||||
flash:
|
||||
success: "Código correcto. Tu cuenta ya está verificada"
|
||||
alert:
|
||||
unconfirmed_code: "Todavía no has introducido el código de confirmación"
|
||||
<<<<<<< HEAD
|
||||
verify_attemps_left: "Has llegado al máximo número de intentos de verificar tu carta."
|
||||
=======
|
||||
errors:
|
||||
letter_not_sent: "Aún no te hemos enviado la carta con el código"
|
||||
incorect_code: "Código de verificación incorrecto"
|
||||
address_not_found: "No se ha encontrado una dirección"
|
||||
>>>>>>> adds validation error for letter verification code [#395]
|
||||
verified_user:
|
||||
show:
|
||||
title: "Información disponible"
|
||||
|
||||
Reference in New Issue
Block a user