91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
# File 'lib/auth/two_factor_otp.rb', line 91
def verify(otp)
if Auth.configuration.third_party_api_keys[:two_factor_sms_api_key].nil?
log_error_to_redis("no api key found for two_factor_sms_otp")
else
otp_session_id = $redis.hget(resource.id.to_s + "_two_factor_sms_otp","otp_session_id")
if otp_session_id.nil?
log_error_to_redis("No otp session id found, please click \"resend otp message\" and try again")
else
response = verify_otp_response(otp,otp_session_id)
if response.code == 200
response_body = JSON.parse(response.body).symbolize_keys
if response_body[:Status] == "Success"
resource.otp = otp
resource.additional_login_param_status = 2
resource.save
clear_redis_user_otp_hash
else
log_error_to_redis(response_body[:Details])
end
else
log_error_to_redis("HTTP Error code:"+ response.code.to_s)
end
end
end
end
|