Module: Entrance::Model::ResetMethods

Defined in:
lib/entrance/model.rb

Instance Method Summary collapse

Instance Method Details

#request_password_reset!Object



80
81
82
83
84
85
86
87
88
89
90
# File 'lib/entrance/model.rb', line 80

def request_password_reset!
  send(Entrance.fields.reset_token + '=', Entrance.generate_token)
  if Entrance.fields.reset_until
    timestamp = Time.now + Entrance.config.reset_password_window
    update_attribute(Entrance.fields.reset_until, timestamp)
  end
  if save(:validate => false)
    method = Entrance.config.reset_password_method
    Entrance.config.reset_password_mailer.constantize.send(method, self).deliver
  end
end