Class: Morpho::Operations::User::ResendUnlockEmail
- Inherits:
-
DeliverEmail
show all
- Defined in:
- app/concepts/morpho/operations/user/resend_unlock_email.rb
Instance Method Summary
collapse
#data!, #validate!
Methods inherited from Base::Find
#model_class!, #params!, #present!, #presenter_class!
Instance Method Details
#build_model!(options, data:) ⇒ Object
5
6
7
8
9
10
11
12
13
14
|
# File 'app/concepts/morpho/operations/user/resend_unlock_email.rb', line 5
def build_model!(options, data:, **)
options['model'] = options['model.class'].find_by(email: data.fetch('email'))
if options['model'].nil?
raise Morpho::Exceptions::StandardError.new(
message: I18n.t('morpho.api.messages.unlock.email_not_exists'),
status: 404
)
end
end
|
#check!(options, model:) ⇒ Object
16
17
18
19
20
21
22
23
|
# File 'app/concepts/morpho/operations/user/resend_unlock_email.rb', line 16
def check!(options, model:, **)
unless options['model'].login_locked?
raise Morpho::Exceptions::StandardError.new(
message: I18n.t('morpho.api.messages.unlock.account_not_locked'),
status: 405
)
end
end
|
#deliver!(options, model:) ⇒ Object
25
26
27
|
# File 'app/concepts/morpho/operations/user/resend_unlock_email.rb', line 25
def deliver!(options, model:, **)
model.resend_unlock_token_email!
end
|