在Sails Auth中添加自定义错误消息

时间:2015-06-18 13:40:53

标签: sails.js

{
  "Error.Passport.Password.Invalid": "The provided password is invalid!",
  "Error.Passport.Password.Wrong": "Whoa, that password wasn't quite right!",
  "Error.Passport.Password.NotSet": "Oh no, you haven't set a password yet!",
  "Error.Passport.Username.NotFound": "Uhm, what's your name again?",
  "Error.Passport.User.Exists": "This username is already taken.",
  "Error.Passport.Email.NotFound": "That email doesn't seem right",
  "Error.Passport.Email.Missing": "You need to supply an email-address for verification",
  "Error.Passport.Email.Exists": "This email already exists. So try logging in.",
  "Error.Passport.Username.Missing": "You need to supply a username",
  "Error.Passport.Password.Missing": "Oh no, you haven't set a password yet!",
  "Error.Passport.Generic": "Snap. Something went wrong with authorization."
}

我需要在哪里添加此错误消息才能在Sails Auth中显示自定义错误消息?

1 个答案:

答案 0 :(得分:2)

您必须在config / locales / {{lang}}下的本地化文件中添加此项.json 并重新启动服务器以重新加载语言环境文件