mirror of
https://github.com/iv-org/invidious.git
synced 2025-08-29 07:58:35 +00:00
Fix text captcha validation
This commit is contained in:
parent
8a24dd0e0f
commit
4dcf2b08e5
@ -215,15 +215,27 @@ module Invidious::Routes::Login
|
|||||||
return error_template(400, "Erroneous CAPTCHA")
|
return error_template(400, "Erroneous CAPTCHA")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Text Captcha Validation
|
||||||
|
# There's a possibility that there could be multiple tokens and therefore we'd need to
|
||||||
|
# check them all and only error once we've made sure that none of them passes the check.
|
||||||
found_valid_captcha = false
|
found_valid_captcha = false
|
||||||
|
error_exception = Exception.new
|
||||||
|
|
||||||
tokens.each do |tok|
|
tokens.each do |tok|
|
||||||
begin
|
begin
|
||||||
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
|
||||||
|
|
||||||
|
break
|
||||||
rescue ex
|
rescue ex
|
||||||
return error_template(400, "Erroneous CAPTCHA")
|
error_exception = ex
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Error when validation fail
|
||||||
|
if !found_valid_captcha
|
||||||
|
return error_template(400, "Erroneous CAPTCHA")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self.register_user(env, email, password)
|
self.register_user(env, email, password)
|
||||||
|
Loading…
Reference in New Issue
Block a user