我试图完全覆盖Devise的错误消息'reset_password_token is invalid'
。我想阅读"password reset link has already been used."
我该怎么做?在devise.en.yml
中没有看到相关字段或关键字。
答案 0 :(得分:2)
比覆盖passwords_controller更简单的解决方案就是修改视图:
在app / views / devise / passwords / edit.html.haml(或等效的erb)中, 只需将此条件放在表单中:
- if resource.errors[:reset_password_token].present?
.alert.alert-danger
This password reset URL has expired. You may have requested to reset your password more than once. Follow the link in the most recent email or
= link_to 'request to reset your password again.', new_user_password_path
您可能想要删除这两行:
= f.error_notification
= f.full_error :reset_password_token