lundi 16 octobre 2017

Check is it valid reset_password_token, Rails 5 devise

I am using Rails 5 with Devise. I want when some1 make request for new password, then go to the URL to change his password, if it is not valid reset_password_token to return 404:

unless confirm_token.errors.empty?
  raise ActionController::RoutingError.new('Not Found')
end

For this I need to check is it GET parameter reset_password_token same as one in the table column reset_password_token.

There is a method for that confirm_by_token, but it is for validate email URL and checks column 'confirmation_token'. Is there build in Devise method for checking is it valid reset_password_token or I need to create it ?

Aucun commentaire:

Enregistrer un commentaire