mirror of
https://github.com/neocities/neocities.git
synced 2025-07-01 00:23:26 +02:00
fixes for hcaptcha, add to dmca form
This commit is contained in:
parent
79cdd06b19
commit
2821f513f1
9 changed files with 32 additions and 25 deletions
|
@ -135,3 +135,24 @@ def recaptcha_valid?
|
|||
false
|
||||
end
|
||||
end
|
||||
|
||||
def hcaptcha_valid?
|
||||
return true if ENV['RACK_ENV'] == 'test' || ENV['TRAVIS']
|
||||
return false unless params[:'h-captcha-response']
|
||||
|
||||
resp = Net::HTTP.get URI(
|
||||
'https://hcaptcha.com/siteverify?'+
|
||||
Rack::Utils.build_query(
|
||||
secret: $config['hcaptcha_secret_key'],
|
||||
response: params[:'h-captcha-response']
|
||||
)
|
||||
)
|
||||
|
||||
resp = JSON.parse resp
|
||||
|
||||
if resp['success'] == true
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue