mirror of
https://github.com/iv-org/invidious.git
synced 2025-04-20 15:45:46 -04:00
Update authentication.cr
This commit is contained in:
parent
550140627d
commit
b66a15e890
@ -43,14 +43,14 @@ module Invidious::Routes::API::V1::Authentication
|
||||
# check if user is responding to captcha
|
||||
if captcha_response
|
||||
# process captcha response
|
||||
# answer = captcha_response.answer
|
||||
# answer = answer.lstrip('0')
|
||||
# answer = OpenSSL::HMAC.hexdigest(:sha256, HMAC_KEY, answer)
|
||||
# begin
|
||||
# validate_request(, answer, env.request, HMAC_KEY, locale)
|
||||
# rescue ex
|
||||
# return error_jsonror(400, ex)
|
||||
# end
|
||||
answer = captcha_response.answer
|
||||
answer = answer.lstrip('0')
|
||||
answer = OpenSSL::HMAC.hexdigest(:sha256, HMAC_KEY, answer)
|
||||
begin
|
||||
validate_request(captcha_response.tokens[0], answer, env.request, HMAC_KEY, locale)
|
||||
rescue ex
|
||||
return error_jsonror(400, ex)
|
||||
end
|
||||
else
|
||||
# send captcha
|
||||
captcha = Invidious::User::Captcha.generate_text(HMAC_KEY)
|
||||
@ -144,7 +144,7 @@ struct CaptchaResponse
|
||||
property username : String
|
||||
property password : String
|
||||
property answer : String
|
||||
# property tokens : Array()
|
||||
property tokens : Array(String)
|
||||
end
|
||||
|
||||
struct Credentials
|
||||
|
Loading…
x
Reference in New Issue
Block a user