In my password change controller, I m allowing users to change their password provided they have valid password request token.
However after they've already used one it becomes invalid and so if they want to re-use it again, the user gets an error on the model:
Reset password token is invalid
This is from Devise itself. How can modify this message to be :
User reset password token already used
If I cannot change the message via some configuration, then is there a method that would allow me to check if the token is valid or not?
So that I can manually render this message in this case
It's not Devise, but ActiveModel error message:
person.errors.full_message(:name, 'is invalid') # => "Name is invalid"
And you can overwrite it in your locale file.
en:
activerecord:
attributes:
user:
reset_password_token: User reset password token
errors:
models:
user:
attributes:
reset_password_token:
invalid: already used