mirror of
https://github.com/iv-org/invidious.git
synced 2025-04-21 16:06:32 -04: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")
|
||||
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
|
||||
error_exception = Exception.new
|
||||
|
||||
tokens.each do |tok|
|
||||
begin
|
||||
validate_request(tok, answer, env.request, HMAC_KEY, locale)
|
||||
found_valid_captcha = true
|
||||
|
||||
break
|
||||
rescue ex
|
||||
return error_template(400, "Erroneous CAPTCHA")
|
||||
error_exception = ex
|
||||
end
|
||||
end
|
||||
|
||||
# Error when validation fail
|
||||
if !found_valid_captcha
|
||||
return error_template(400, "Erroneous CAPTCHA")
|
||||
end
|
||||
end
|
||||
|
||||
self.register_user(env, email, password)
|
||||
|
Loading…
x
Reference in New Issue
Block a user