Class: CommandTower::Workflows::Auth::PasswordRecoverySession::CreateWorkflow
- Inherits:
-
CommandTower::Workflows::ApplicationWorkflow
- Object
- CommandTower::Workflows::ApplicationWorkflow
- CommandTower::Workflows::Auth::PasswordRecoverySession::CreateWorkflow
- Defined in:
- app/workflows/command_tower/workflows/auth/password_recovery_session/create_workflow.rb
Constant Summary
Constants inherited from CommandTower::Workflows::ApplicationWorkflow
CommandTower::Workflows::ApplicationWorkflow::ALLOWED_RETRY_STRATEGIES, CommandTower::Workflows::ApplicationWorkflow::InvalidTransactionResult, CommandTower::Workflows::ApplicationWorkflow::TransactionFailure
Instance Method Summary collapse
Methods inherited from CommandTower::Workflows::ApplicationWorkflow
call, call_from_job, continuation_max_attempts, declared_retry_strategy, mark_impersonation_activity!, retry_strategy, validate_retry_strategy!
Methods included from Impersonation::ActivityDeclaration
Methods included from Logging::LifecycleDeclaration
Methods included from Execution::ContextAccess
#audit, #execution_context, #log_debug, #log_error, #log_info, #log_warn, #publish_event
Methods included from Transactional
#fail_transaction!, #transaction
Instance Method Details
#call(client_ip:) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/workflows/command_tower/workflows/auth/password_recovery_session/create_workflow.rb', line 10 def call(client_ip:) rate_result = CommandTower::Services::Auth::PasswordRecovery::RateLimits::CheckTokenIssue.call( client_ip: client_ip ) unless rate_result.success? return failure( errors: rate_result.errors, http_status: IdentityErrorStatus.http_status_for(rate_result.errors.first) ) end create_result = CommandTower::Services::Auth::PasswordRecoverySession::Create.call unless create_result.success? return failure(errors: create_result.errors, http_status: :internal_server_error) end data = create_result.data success( payload: CommandTower::Serializers::Auth::PasswordRecoverySessionResponseSerializer.serialize( token: data[:token], expires_at: data[:expires_at] ), http_status: :created ) end |