Module: Clearance::User

Extended by:
ActiveSupport::Concern
Defined in:
lib/clearance/user.rb

Defined Under Namespace

Modules: Callbacks, ClassMethods, Validations

Instance Method Summary collapse

Instance Method Details

#forgot_password!Object



65
66
67
68
# File 'lib/clearance/user.rb', line 65

def forgot_password!
  generate_confirmation_token
  save validate: false
end

#reset_remember_token!Object



70
71
72
73
# File 'lib/clearance/user.rb', line 70

def reset_remember_token!
  generate_remember_token
  save validate: false
end

#update_password(new_password) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
# File 'lib/clearance/user.rb', line 75

def update_password(new_password)
  self.password_changing = true
  self.password = new_password

  if valid?
    self.confirmation_token = nil
    generate_remember_token
  end

  save
end