Devise get user by reset_password_token

Older versions of devise don't contain this method: with_reset_password_token(your_token_here)

So you can create this method in your model:

def self.with_password_reset_token(password_reset_token)
    generated_password_reset_token = Devise.token_generator.digest(self, :reset_password_token, password_reset_token)
    return self.find_by(reset_password_token: generated_password_reset_token)
  end

Then you can call this method from your model like this:

user = User.with_password_reset_token(your_token_here)

We are using user model here in the example.


Assuming your model is User:

User.with_reset_password_token(your_token_here)

Source