mirror of
https://github.com/iv-org/invidious.git
synced 2025-08-28 15:38:30 +00:00
Update authentication.cr
This commit is contained in:
parent
d7a1fc6d44
commit
40ca8898d4
@ -1,10 +1,11 @@
|
|||||||
module Invidious::Routes::API::V1::Authentication
|
module Invidious::Routes::API::V1::Authentication
|
||||||
def self.register(env)
|
def self.register(env)
|
||||||
env.response.content_type = "application/json"
|
env.response.content_type = "application/json"
|
||||||
|
body_json = env.request.body || "{}"
|
||||||
if CONFIG.registration_enabled
|
if CONFIG.registration_enabled
|
||||||
creds = nil
|
creds = nil
|
||||||
begin
|
begin
|
||||||
creds = Credentials.from_json(env.request.body || "{}")
|
creds = Credentials.from_json(body_json)
|
||||||
rescue
|
rescue
|
||||||
end
|
end
|
||||||
# get user info
|
# get user info
|
||||||
@ -36,7 +37,11 @@ module Invidious::Routes::API::V1::Authentication
|
|||||||
password = password.byte_slice(0, 55)
|
password = password.byte_slice(0, 55)
|
||||||
# send captcha if enabled
|
# send captcha if enabled
|
||||||
if CONFIG.captcha_enabled
|
if CONFIG.captcha_enabled
|
||||||
captcha_response = CaptchaResponse.from_json(env.request.body || "{}")
|
captcha_response = nil
|
||||||
|
begin
|
||||||
|
captcha_response = CaptchaResponse.from_json(body_json)
|
||||||
|
rescue
|
||||||
|
end
|
||||||
if captcha_response
|
if captcha_response
|
||||||
answer = captcha_response.answer
|
answer = captcha_response.answer
|
||||||
tokens = captcha_response.tokens
|
tokens = captcha_response.tokens
|
||||||
|
Loading…
Reference in New Issue
Block a user