Class: RailsBase::Authentication::SsoVerifyEmail
- Inherits:
-
ServiceBase
- Object
- ServiceBase
- RailsBase::Authentication::SsoVerifyEmail
show all
- Defined in:
- app/services/rails_base/authentication/sso_verify_email.rb
Instance Method Summary
collapse
Methods inherited from ServiceBase
inherited, #internal_validate, #service_base_logging
#aletered_message, #class_name, #log, #log_prefix, #logger, #service_id
Instance Method Details
#call ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'app/services/rails_base/authentication/sso_verify_email.rb', line 5
def call
datum = get_short_lived_datum(verification)
validate_datum?(datum)
user = datum[:user]
user.update(email_validated: true)
context.user = datum[:user]
params = {
expires_at: Time.zone.now + Constants::SVE_TTL,
user: user,
purpose: Constants::SSOVE_PURPOSE
}
context.encrypted_val = MfaSetEncryptToken.call(params).encrypted_val
end
|
#get_short_lived_datum(mfa_code) ⇒ Object
#validate! ⇒ Object
39
40
41
|
# File 'app/services/rails_base/authentication/sso_verify_email.rb', line 39
def validate!
raise "verification is expected" if verification.nil?
end
|
#validate_datum?(datum) ⇒ Boolean
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'app/services/rails_base/authentication/sso_verify_email.rb', line 21
def validate_datum?(datum)
return true if datum[:valid]
if datum[:found]
msg = "Errors with Email Verification: #{datum[:invalid_reason].join(", ")}. Please login again"
log(level: :warn, msg: msg)
context.fail!(message: msg, redirect_url: Constants::URL_HELPER.new_user_session_path, level: :warn)
end
log(level: :warn, msg: "Could not find MFA code. Incorrect Email verification code. User may be doing Fishyyyyy things")
context.fail!(message: "Invalid Email Verification Code. Log in again.", redirect_url: Constants::URL_HELPER.new_user_session_path, level: :warn)
end
|