Class: Masks::Credentials::Recovery
- Inherits:
-
Masks::Credential
- Object
- ApplicationModel
- Masks::Credential
- Masks::Credentials::Recovery
- Defined in:
- app/models/masks/credentials/recovery.rb
Overview
Checks for a :recovery on the session.
Instance Method Summary collapse
Methods inherited from Masks::Credential
#backup, #backup!, #check, checks, #cleanup, #cleanup!, #mask!, #name, #patch_params, #slug
Instance Method Details
#lookup ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/models/masks/credentials/recovery.rb', line 9 def lookup return if actor @recovery = if recovery_key config.find_recovery(session, token: recovery_key) else config.build_recovery( session, nickname: nickname_param, email: email_param, phone: phone_param, value: recovery_value ) end session.extras(recovery: @recovery) @recovery&.actor end |
#maskup ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/models/masks/credentials/recovery.rb', line 30 def maskup return unless valid? && actor if recovery_key if recovery_password && @recovery&.valid? @recovery.reset_password!(recovery_password) approve! end elsif recovery_value && @recovery&.valid? @recovery.notify! end end |