module Sorcery::Model::Submodules::ResetPassword::ClassMethods

Public Instance Methods

load_from_reset_password_token(token, &block) click to toggle source

Find user by token, also checks for expiration. Returns the user if token found and is valid.

# File lib/sorcery/model/submodules/reset_password.rb, line 62
def load_from_reset_password_token(token, &block)
  load_from_token(
    token,
    @sorcery_config.reset_password_token_attribute_name,
    @sorcery_config.reset_password_token_expires_at_attribute_name,
    &block
  )
end

Protected Instance Methods

define_reset_password_fields() click to toggle source
# File lib/sorcery/model/submodules/reset_password.rb, line 80
def define_reset_password_fields
  sorcery_adapter.define_field sorcery_config.reset_password_token_attribute_name, String
  sorcery_adapter.define_field sorcery_config.reset_password_token_expires_at_attribute_name, Time
  sorcery_adapter.define_field sorcery_config.reset_password_email_sent_at_attribute_name, Time
end
validate_mailer_defined() click to toggle source

This submodule requires the developer to define his own mailer class to be used by it when reset_password_mailer_disabled is false

# File lib/sorcery/model/submodules/reset_password.rb, line 75
def validate_mailer_defined
  message = 'To use reset_password submodule, you must define a mailer (config.reset_password_mailer = YourMailerClass).'
  raise ArgumentError, message if @sorcery_config.reset_password_mailer.nil? && @sorcery_config.reset_password_mailer_disabled == false
end