class PasswordResetToken

Model for managing password reset tokens

Automatically generated by the orthodox gem (github.com/katanacode/orthodox) © Copyright 2019 Katana Code Ltd. All Rights Reserved.

Schema Information

Table name: password_reset_tokens

id             :bigint           not null, primary key
expires_at     :datetime
resetable_type :string           not null
secret         :string
created_at     :datetime         not null
updated_at     :datetime         not null
resetable_id   :bigint           not null

Indexes

index_password_reset_tokens_on_expires_at                       (expires_at)
index_password_reset_tokens_on_resetable_type_and_resetable_id  (resetable_type,resetable_id)
index_password_reset_tokens_on_secret                           (secret) UNIQUE

Constants

EXPIRES_AFTER

How long should password reset links be valid for?

Public Instance Methods

expired?() click to toggle source
# File lib/generators/authentication/templates/models/password_reset_token.rb, line 54
def expired?
  expires_at <= Time.current
end

Private Instance Methods

set_expires_at() click to toggle source
# File lib/generators/authentication/templates/models/password_reset_token.rb, line 60
def set_expires_at
  self.expires_at = EXPIRES_AFTER.from_now
end