Skip to content

Instantly share code, notes, and snippets.

@nambrot
Created September 12, 2014 03:51
Show Gist options
  • Save nambrot/ceff6f3890b23f8ff50c to your computer and use it in GitHub Desktop.
Save nambrot/ceff6f3890b23f8ff50c to your computer and use it in GitHub Desktop.
/app/controllers/devise/passwords_controller.rb
# GET /resource/password/edit?reset_password_token=abcdef
def edit
# Find the resource with the token
self.resource = resource_class.find_by_reset_password_token!(params[:reset_password_token])
# Add the error if the password period is invalid
resource.errors.add :reset_password_token, :expired unless resource.reset_password_period_valid?
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment