简体   繁体   中英

Modify Devise reset password error text

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?

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM