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
37c9af0bcb
commit
0b44d4639d
@ -15,14 +15,17 @@ module Invidious::Routes::API::V1::Authentication
|
|||||||
if old_sid != ""
|
if old_sid != ""
|
||||||
Invidious::Database::SessionIDs.delete(sid: old_sid)
|
Invidious::Database::SessionIDs.delete(sid: old_sid)
|
||||||
end
|
end
|
||||||
token = Invidious::Database::SessionIDs.select_token(sid: sid)
|
if token = Invidious::Database::SessionIDs.select_token(sid: sid)
|
||||||
response = JSON.build do |json|
|
response = JSON.build do |json|
|
||||||
json.object do
|
json.object do
|
||||||
json.field "session", token[:session]
|
json.field "session", token[:session]
|
||||||
json.field "issued", token[:issued].to_unix
|
json.field "issued", token[:issued].to_unix
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
return response
|
||||||
|
else
|
||||||
|
return error_json(500, "Token not found")
|
||||||
end
|
end
|
||||||
return response
|
|
||||||
else
|
else
|
||||||
return error_json(401, "Wrong username or password")
|
return error_json(401, "Wrong username or password")
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user