7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/auth/centric/captcha/check_code.rb', line 7
def verify_code?(id:, code:)
return true unless enabled?
payload = {
security_captcha: {
ip: @ip_address,
code:,
session_id: @session_id
}
}
http = HTTP
.timeout(timeout_seconds)
.(apikey:)
.post(check_code_path(id), json: payload)
case http.status
when 202
return true
when 404, 406
return false
else
raise Error, "#{http.status}: #{http.body}"
end
rescue HTTP::TimeoutError
false
end
|