Class: User::Operation::SignIn

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

Instance Method Summary collapse

Instance Method Details

#authentication_token(options) ⇒ Object



67
68
69
# File 'app/concepts/morpho/user/operation/sign_in.rb', line 67

def authentication_token (options, **)
  options['token'] = Morpho::JWT::Payload.new(options['model'])
end

#check_active(options) ⇒ Object



26
27
28
# File 'app/concepts/morpho/user/operation/sign_in.rb', line 26

def check_active (options, **)
  options['model'].active?
end

#check_password(options) ⇒ Object



34
35
36
# File 'app/concepts/morpho/user/operation/sign_in.rb', line 34

def check_password (options, **)
  options['model'].valid_password?(options['data']['password'])
end

#check_unlocked(options) ⇒ Object



30
31
32
# File 'app/concepts/morpho/user/operation/sign_in.rb', line 30

def check_unlocked (options, **)
  options['model'].unlocked?
end

#find(options) ⇒ Object



22
23
24
# File 'app/concepts/morpho/user/operation/sign_in.rb', line 22

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

#generate_refresh_token(options) ⇒ Object



38
39
40
# File 'app/concepts/morpho/user/operation/sign_in.rb', line 38

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

#locked(options) ⇒ Object



58
59
60
# File 'app/concepts/morpho/user/operation/sign_in.rb', line 58

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

#not_active(options) ⇒ Object



54
55
56
# File 'app/concepts/morpho/user/operation/sign_in.rb', line 54

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

#not_found(options) ⇒ Object



50
51
52
# File 'app/concepts/morpho/user/operation/sign_in.rb', line 50

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

#not_valid(options) ⇒ Object



46
47
48
# File 'app/concepts/morpho/user/operation/sign_in.rb', line 46

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

#register_last_login_activity(options) ⇒ Object



42
43
44
# File 'app/concepts/morpho/user/operation/sign_in.rb', line 42

def  (options, **)
  options['model'].(options['ip'])
end

#validate(options) ⇒ Object



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

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

#wrong_password(options) ⇒ Object



62
63
64
65
# File 'app/concepts/morpho/user/operation/sign_in.rb', line 62

def wrong_password (options, **)
  options['model'].register_failed_login!
  options['error'] = :wrong_password
end