Class: JwtAuthEngine::ChangePasswordService
- Inherits:
-
BaseService
- Object
- BaseService
- JwtAuthEngine::ChangePasswordService
- Defined in:
- app/services/jwt_auth_engine/change_password_service.rb
Overview
Changes password for an authenticated auth model record.
Instance Attribute Summary collapse
-
#auth_model_instance ⇒ Object
readonly
Returns the value of attribute auth_model_instance.
-
#current_password ⇒ Object
readonly
Returns the value of attribute current_password.
-
#new_password ⇒ Object
readonly
Returns the value of attribute new_password.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(auth_model_instance:, change_password_params:) ⇒ ChangePasswordService
constructor
A new instance of ChangePasswordService.
Methods inherited from BaseService
Constructor Details
#initialize(auth_model_instance:, change_password_params:) ⇒ ChangePasswordService
Returns a new instance of ChangePasswordService.
8 9 10 11 12 13 |
# File 'app/services/jwt_auth_engine/change_password_service.rb', line 8 def initialize(auth_model_instance:, change_password_params:) @auth_model_instance = auth_model_instance @current_password = change_password_params[JwtAuthEngine.current_password_field] @new_password = change_password_params[JwtAuthEngine.new_password_field] super() end |
Instance Attribute Details
#auth_model_instance ⇒ Object (readonly)
Returns the value of attribute auth_model_instance.
6 7 8 |
# File 'app/services/jwt_auth_engine/change_password_service.rb', line 6 def auth_model_instance @auth_model_instance end |
#current_password ⇒ Object (readonly)
Returns the value of attribute current_password.
6 7 8 |
# File 'app/services/jwt_auth_engine/change_password_service.rb', line 6 def current_password @current_password end |
#new_password ⇒ Object (readonly)
Returns the value of attribute new_password.
6 7 8 |
# File 'app/services/jwt_auth_engine/change_password_service.rb', line 6 def new_password @new_password end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 |
# File 'app/services/jwt_auth_engine/change_password_service.rb', line 15 def call return failure(invalid: ) if missing_password_fields? return failure(invalid: ) unless current_password_valid? update_password end |