kopia lustrzana https://github.com/iv-org/invidious
Add more informative error response on incorrect CAPTCHA
rodzic
d185ba84bf
commit
cd482cfd89
|
@ -831,7 +831,12 @@ post "/login" do |env|
|
||||||
begin
|
begin
|
||||||
validate_response(challenge, token, answer, "sign_in", HMAC_KEY, PG_DB)
|
validate_response(challenge, token, answer, "sign_in", HMAC_KEY, PG_DB)
|
||||||
rescue ex
|
rescue ex
|
||||||
|
if ex.message && ex.message == "Invalid user"
|
||||||
|
error_message = "Invalid CAPTCHA response"
|
||||||
|
else
|
||||||
error_message = ex.message
|
error_message = ex.message
|
||||||
|
end
|
||||||
|
|
||||||
next templated "error"
|
next templated "error"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -251,7 +251,7 @@ def validate_response(challenge, token, user_id, operation, key, db)
|
||||||
end
|
end
|
||||||
|
|
||||||
if challenge_user_id != user_id
|
if challenge_user_id != user_id
|
||||||
raise "Invalid token"
|
raise "Invalid user"
|
||||||
end
|
end
|
||||||
|
|
||||||
if expire < Time.now.to_unix
|
if expire < Time.now.to_unix
|
||||||
|
|
Ładowanie…
Reference in New Issue