Class: User::Operation::ResetPassword

Inherits:
Trailblazer::Operation
  • Object
show all
Defined in:
app/concepts/morpho/user/operation/reset_password.rb

Instance Method Summary collapse

Instance Method Details

#check(options) ⇒ Object



21
22
23
# File 'app/concepts/morpho/user/operation/reset_password.rb', line 21

def check (options, **)
  !options['model'].external?
end

#find(options) ⇒ Object



17
18
19
# File 'app/concepts/morpho/user/operation/reset_password.rb', line 17

def find (options, **)
  options['model'] = Morpho::User.find_by(email: options['data']['email'])
end

#not_allowed(options) ⇒ Object



37
38
39
# File 'app/concepts/morpho/user/operation/reset_password.rb', line 37

def not_allowed (options, **)
  options['error'] = :not_allowed
end

#not_delivered(options) ⇒ Object



41
42
43
# File 'app/concepts/morpho/user/operation/reset_password.rb', line 41

def not_delivered (options, **)
  options['error'] = :not_delivered
end

#not_found(options) ⇒ Object



33
34
35
# File 'app/concepts/morpho/user/operation/reset_password.rb', line 33

def not_found (options, **)
  options['error'] = :not_found
end

#not_valid(options) ⇒ Object



29
30
31
# File 'app/concepts/morpho/user/operation/reset_password.rb', line 29

def not_valid (options, **)
  options['error'] = :not_valid
end

#render(options) ⇒ Object



45
46
47
# File 'app/concepts/morpho/user/operation/reset_password.rb', line 45

def render (options, **)
  options['model']
end

#reset_password_email(options) ⇒ Object



25
26
27
# File 'app/concepts/morpho/user/operation/reset_password.rb', line 25

def reset_password_email (options, **)
  options['model'].deliver_reset_password_instructions!
end

#validate(options) ⇒ Object



12
13
14
15
# File 'app/concepts/morpho/user/operation/reset_password.rb', line 12

def validate (options, **)
  options['contract'] = Morpho::User::Contract::ResetPassword.new(OpenStruct.new)
  options['contract'].validate(options['data'])
end