Class: User::Operation::SignIn
- Inherits:
-
Trailblazer::Operation
- Object
- Trailblazer::Operation
- User::Operation::SignIn
- Defined in:
- app/concepts/morpho/user/operation/sign_in.rb
Instance Method Summary collapse
- #authentication_token(options) ⇒ Object
- #check_active(options) ⇒ Object
- #check_password(options) ⇒ Object
- #check_unlocked(options) ⇒ Object
- #find(options) ⇒ Object
- #generate_refresh_token(options) ⇒ Object
- #locked(options) ⇒ Object
- #not_active(options) ⇒ Object
- #not_found(options) ⇒ Object
- #not_valid(options) ⇒ Object
- #register_last_login_activity(options) ⇒ Object
- #validate(options) ⇒ Object
- #wrong_password(options) ⇒ Object
Instance Method Details
#authentication_token(options) ⇒ Object
67 68 69 |
# File 'app/concepts/morpho/user/operation/sign_in.rb', line 67 def authentication_token (, **) ['token'] = Morpho::JWT::Payload.new(['model']) end |
#check_active(options) ⇒ Object
26 27 28 |
# File 'app/concepts/morpho/user/operation/sign_in.rb', line 26 def check_active (, **) ['model'].active? end |
#check_password(options) ⇒ Object
34 35 36 |
# File 'app/concepts/morpho/user/operation/sign_in.rb', line 34 def check_password (, **) ['model'].valid_password?(['data']['password']) end |
#check_unlocked(options) ⇒ Object
30 31 32 |
# File 'app/concepts/morpho/user/operation/sign_in.rb', line 30 def check_unlocked (, **) ['model'].unlocked? end |
#find(options) ⇒ Object
22 23 24 |
# File 'app/concepts/morpho/user/operation/sign_in.rb', line 22 def find (, **) ['model'] = Morpho::User.find_by(email: ['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 (, **) ['model'].generate_refresh_token! end |
#locked(options) ⇒ Object
58 59 60 |
# File 'app/concepts/morpho/user/operation/sign_in.rb', line 58 def locked (, **) ['error'] = :locked end |
#not_active(options) ⇒ Object
54 55 56 |
# File 'app/concepts/morpho/user/operation/sign_in.rb', line 54 def not_active (, **) ['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 (, **) ['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 (, **) ['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 register_last_login_activity (, **) ['model'].register_last_login_activity!(['ip']) end |
#validate(options) ⇒ Object
17 18 19 20 |
# File 'app/concepts/morpho/user/operation/sign_in.rb', line 17 def validate (, **) ['contract'] = Morpho::User::Contract::SignIn.new(OpenStruct.new) ['contract'].validate(['data']) end |
#wrong_password(options) ⇒ Object
62 63 64 65 |
# File 'app/concepts/morpho/user/operation/sign_in.rb', line 62 def wrong_password (, **) ['model'].register_failed_login! ['error'] = :wrong_password end |