class User
Public Instance Methods
confirm!(ip)
click to toggle source
# File lib/dangerzone/templates/models/user.rb, line 36 def confirm!(ip) self.update_attributes( sign_in_ip: ip, confirmed: true, reset_password_sent_at: nil, reset_password_token: nil ) end
in_time?()
click to toggle source
# File lib/dangerzone/templates/models/user.rb, line 44 def in_time? (Time.now - self.reset_password_sent_at) < 24.hours if self.reset_password_sent_at end
sign_in!(ip, password_param)
click to toggle source
# File lib/dangerzone/templates/models/user.rb, line 28 def sign_in!(ip, password_param) return false unless self.confirmed && self.authenticate(password_param) self.update_attributes( sign_in_ip: ip, sign_in_count: (self.sign_in_count + 1), remember_token: SecureRandom.urlsafe_base64 ) end
token_matches?(token)
click to toggle source
# File lib/dangerzone/templates/models/user.rb, line 48 def token_matches?(token) self.reset_password_token == token end
update_reset_password_credentials()
click to toggle source
# File lib/dangerzone/templates/models/user.rb, line 22 def update_reset_password_credentials self.update_attributes( reset_password_sent_at: Time.now, reset_password_token: SecureRandom.urlsafe_base64 ) end