2
votes

I have changed the default minimum length for password from @@password_length = 5..128 to 6..128. When I give failing validation for password during the signup, the validation error is showing as "is too short (minimum is 5 characters)". How to change this error message to "minimum 6 characters". I read some anuswers in stackoverflow they say to look in to devise.views.en.yml . But still can't change the error message.

My devise.views.en.yml (password field) looks like:

passwords:
  edit:
    change_my_password: Change my password
    change_your_password: Change your password
    confirm_new_password: Confirm new password
    new_password: New password
  new:
    forgot_your_password: Forgot your password?
    send_me_reset_password_instructions: Send me reset password instructions
  no_token: You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided.
  send_instructions: You will receive an email with instructions on how to reset your password in a few minutes.
  send_paranoid_instructions: If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes.
  updated: Your password has been changed successfully. You are now signed in.
  updated_not_active: Your password has been changed successfully.

Suggestions are most welcomed

1
Have you restarted the server after you changed the YML file ?Shiko
after changing the value in devise.rb, did you restart server ?Vishal
I didn't change anything in YML file. I don't know where should I make changeNAREN PUSHPARAJU
This link can help you!John Baker

1 Answers

4
votes

You'll have to override the devise.en.yml file in the following manner

en:
  activerecord:
    errors:
      models:
        user:
          attributes:
            password:
              too_short: "Password is too short (minimum is %{count} characters)"