Method: Devise::Models::Recoverable#reset_password

Defined in:
lib/devise/models/recoverable.rb

#reset_password(new_password, new_password_confirmation) ⇒ Object

Update password saving the record and clearing token. Returns true if the passwords are valid and the record was saved, false otherwise.


37
38
39
40
41
42
43
44
45
46
# File 'lib/devise/models/recoverable.rb', line 37

def reset_password(new_password, new_password_confirmation)
  if new_password.present?
    self.password = new_password
    self.password_confirmation = new_password_confirmation
    save
  else
    errors.add(:password, :blank)
    false
  end
end