我试图在用户无法登录时显示一个闪光警报。但是,将有两种不同的情况:
用户输入的邮箱存在,但密码错误。我希望显示此消息:
The email address or password you entered is incorrect.
用户输入的电子邮件不存在。我希望显示此消息:
The email address and password you entered do not match our records. (You provided <span class='black'>#{params[:email]}</span>)<br/><br/> <a href='/accounts/forgot_password' class='decorate'>Having trouble accessing your account?</a>
是否有类似于after_sign_in_path
我可以根据这些条件修改闪光灯的钩子?
更新
所以我找到了这个。但是我如何只传递 email 变量not_found_in_database
呢?
en:
devise:
failure:
already_authenticated: "You are already signed in."
invalid: "The email address or password you entered is incorrect."
not_found_in_database: "The email address and password you entered do not match our records. (You provided <span class='black'>%{email}</span>)<br/><br/><a href='/accounts/forgot_password' class='decorate'>Having trouble accessing your account?</a>."