3

Using the Devise GEM, when a user password is reset they are allowed to set a new password. If the entered passwords do not match or if the password is too short, you get default messages:

•Password doesn't match confirmation

•Password is too short (minimum is 8 characters)

How/where can I change the text of these error messages?

Community
  • 1
  • 1
Justin
  • 26,443
  • 16
  • 111
  • 128
  • 1
    look at config/locals/en.yml https://github.com/plataformatec/devise/blob/master/config/locales/en.yml – Sam Dec 11 '13 at 22:07
  • 1
    actually the messages you want aren't there look at this link http://stackoverflow.com/questions/9330821/how-to-override-devise-error-messages-on-password-change – Sam Dec 11 '13 at 22:09
  • Yep, the messages shown are actually from activerecord as the accepted answer shows. – Justin Dec 11 '13 at 22:53

1 Answers1

17

Add this to your config/locals/en.yml and change it to what you want

en:
  activerecord:
    errors:
      models:
        user:
          attributes:
            password:
              confirmation: "Password does not match"
              too_short: "is too short (minimum is %{count} characters)"
    attributes:
      user:
        password: "Password"
Diego Somar
  • 941
  • 1
  • 11
  • 28
usha
  • 28,973
  • 5
  • 72
  • 93
  • 2
    the resulting message for this is "Password Password does not match" ... Where is the first word coming from? I ask because I want to change it to "Passwords do not match" (plural) – Justin Dec 16 '13 at 19:25
  • You should use %{count} in the error message rather than hard coding the minimum value. count is passed to I18n.t by the range validator, and therefore will always match the devise setting. – ReggieB Feb 16 '15 at 09:07