mirror of
https://github.com/iv-org/invidious.git
synced 2025-08-28 23:48:31 +00:00
Update authentication.cr
This commit is contained in:
parent
c39bc80d98
commit
268d6ceae5
@ -58,6 +58,7 @@ module Invidious::Routes::API::V1::Authentication
|
|||||||
error_exception = Exception.new
|
error_exception = Exception.new
|
||||||
tokens.each do |tok|
|
tokens.each do |tok|
|
||||||
begin
|
begin
|
||||||
|
# TO-DO fix formatting of tokens when recieved from Captcha.generate_text
|
||||||
validate_request(tok, answer, env.request, HMAC_KEY, locale)
|
validate_request(tok, answer, env.request, HMAC_KEY, locale)
|
||||||
found_valid_captcha = true
|
found_valid_captcha = true
|
||||||
rescue ex
|
rescue ex
|
||||||
@ -71,11 +72,12 @@ module Invidious::Routes::API::V1::Authentication
|
|||||||
else
|
else
|
||||||
# send captcha
|
# send captcha
|
||||||
captcha = Invidious::User::Captcha.generate_text(HMAC_KEY, ":register")
|
captcha = Invidious::User::Captcha.generate_text(HMAC_KEY, ":register")
|
||||||
# puts captcha
|
# TODO Fix the formatting of tokens when it is recieved
|
||||||
|
# from Captcha.generate_text
|
||||||
captcha_request = JSON.build do |json|
|
captcha_request = JSON.build do |json|
|
||||||
json.object do
|
json.object do
|
||||||
json.field "question", captcha["question"]
|
json.field "question", captcha["question"]
|
||||||
json.field "tokens", captcha["tokens"]
|
json.field "tokens", Array(String).from_json(captcha["tokens"])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return captcha_request
|
return captcha_request
|
||||||
|
Loading…
Reference in New Issue
Block a user