@@ -36,9 +36,9 @@ sqlalchemy.url = sqlite:///%(here)s/pizzavolus.sqlite | |||
#app.user_log_limit = 10 | |||
#app.address_log_limit = 5 | |||
# Recaptcha site key and secret key, to use recaptcha on open domains | |||
#app.recaptcha_site = | |||
#app.recaptcha_secret = | |||
# Recaptcha site key and secret key, to use hcaptcha on open domains | |||
#app.hcaptcha_site = | |||
#app.hcaptcha_secret = | |||
# Required access level to see logs. | |||
# "address" < "user" < other values (disable log access) | |||
@@ -113,12 +113,12 @@ class AppConfig: | |||
self.user_log_limit = int(d.get('user_log_limit', 10)) | |||
self.address_log_limit = int(d.get('address_log_limit', 5)) | |||
default_recaptcha_api = 'https://www.google.com/recaptcha/api/siteverify' | |||
default_hcaptcha_api = 'https://hcaptcha.com/siteverify' | |||
self.recaptcha_site = d.get('recaptcha_site') | |||
self.recaptcha_secret = d.get('recaptcha_secret') | |||
self.recaptcha_api = d.get('recaptcha_api', default_recaptcha_api) | |||
self.use_recaptcha = self.recaptcha_secret and self.recaptcha_site | |||
self.hcaptcha_site = d.get('hcaptcha_site') | |||
self.hcaptcha_secret = d.get('hcaptcha_secret') | |||
self.hcaptcha_api = d.get('hcaptcha_api', default_hcaptcha_api) | |||
self.use_hcaptcha = self.hcaptcha_secret and self.hcaptcha_site | |||
# Required level to see logs. | |||
# "address" < "user" < other values (disable log access) | |||
@@ -6,7 +6,7 @@ | |||
<form class="pure-form pure-form-aligned pure-u-lg-1-2" action="" method="post"> | |||
<fieldset> | |||
% if domains_reg: | |||
<script src="https://www.google.com/recaptcha/api.js" async defer></script> | |||
<script src="https://hcaptcha.com/1/api.js" async defer></script> | |||
<div class="pure-control-group"> | |||
<label for="local_part">Name</label> | |||
@@ -32,31 +32,10 @@ | |||
class="pure-input-1-2" /> | |||
</div> | |||
% if recaptcha_site: | |||
<div class="g-recaptcha" | |||
% if hcaptcha_site: | |||
<div class="h-captcha" | |||
data-theme="dark" | |||
data-sitekey="${recaptcha_site}"></div> | |||
<noscript> | |||
<div style="width: 302px; height: 422px;"> | |||
<div style="width: 302px; height: 422px; position: relative;"> | |||
<div style="width: 302px; height: 422px;"> | |||
<iframe src="https://www.google.com/recaptcha/api/fallback?k=${recaptcha_site}" | |||
frameborder="0" scrolling="no" | |||
style="width: 302px; height:422px; border-style: none;"> | |||
</iframe> | |||
</div> | |||
<div style="width: 300px; height: 60px; border-style: none; | |||
bottom: 12px; left: 25px; margin: 0px; padding: 0px; right: 25px; | |||
background: #f9f9f9; border: 1px solid #c1c1c1; border-radius: 3px;"> | |||
<textarea id="g-recaptcha-response" name="g-recaptcha-response" | |||
class="g-recaptcha-response" | |||
style="width: 250px; height: 40px; border: 1px solid #c1c1c1; | |||
margin: 10px 25px; padding: 0px; resize: none;" > | |||
</textarea> | |||
</div> | |||
</div> | |||
</div> | |||
</noscript> | |||
data-sitekey="${hcaptcha_site}"></div> | |||
% endif | |||
<div class="pure-controls"> | |||
@@ -127,7 +127,7 @@ def root(request): | |||
return dict(domains_reg=domains_available, | |||
lname_pattern=request.appconfig.lname_pattern, | |||
recaptcha_site=request.appconfig.recaptcha_site) | |||
hcaptcha_site=request.appconfig.hcaptcha_site) | |||
@view_config(route_name='root', request_method='POST') | |||
@@ -137,7 +137,7 @@ def root_post(request): | |||
domain_id = int(request.POST['domain']) | |||
password = request.POST['password'] | |||
password2 = request.POST['password2'] | |||
captcha_response = request.POST.get('g-recaptcha-response') | |||
captcha_response = request.POST.get('h-captcha-response') | |||
except (KeyError, ValueError): | |||
return HTTPSeeOther(request.route_url('root')) | |||
@@ -158,10 +158,10 @@ def root_post(request): | |||
request.messages.error("Passwords do not match.") | |||
return HTTPSeeOther(request.route_url('root')) | |||
if request.appconfig.use_recaptcha: | |||
api = request.appconfig.recaptcha_api | |||
if request.appconfig.use_hcaptcha: | |||
api = request.appconfig.hcaptcha_api | |||
post_data = dict( | |||
secret=request.appconfig.recaptcha_secret, | |||
secret=request.appconfig.hcaptcha_secret, | |||
response=captcha_response, | |||
remoteip=request.remote_addr | |||
) | |||
@@ -30,9 +30,9 @@ sqlalchemy.url = sqlite:///%(here)s/pizzavolus.sqlite | |||
#app.user_log_limit = 10 | |||
#app.address_log_limit = 5 | |||
# Recaptcha site key and secret key, to use recaptcha on open domains | |||
#app.recaptcha_site = | |||
#app.recaptcha_secret = | |||
# Recaptcha site key and secret key, to use hcaptcha on open domains | |||
#app.hcaptcha_site = | |||
#app.hcaptcha_secret = | |||
# Required access level to see logs. | |||
# "address" < "user" < other values (disable log access) | |||