Module: Nyauth::ResetPasswordAbility

Extended by:
ActiveSupport::Concern
Included in:
Authenticatable
Defined in:
app/models/concerns/nyauth/reset_password_ability.rb

Instance Method Summary collapse

Instance Method Details

#request_reset_passwordObject



18
19
20
21
22
# File 'app/models/concerns/nyauth/reset_password_ability.rb', line 18

def request_reset_password
  self.reset_password_key = SecureRandom.hex(32)
  self.reset_password_key_expired_at = Time.current + Nyauth.configuration.reset_password_expire_limit
  save
end

#reset_password(params) ⇒ Object



13
14
15
16
# File 'app/models/concerns/nyauth/reset_password_ability.rb', line 13

def reset_password(params)
  self.attributes = params
  self.save(context: :reset_password)
end