diff --git a/cao_blogr/templates/home.jinja2 b/cao_blogr/templates/home.jinja2 index e7a8aec..6ff43e1 100644 --- a/cao_blogr/templates/home.jinja2 +++ b/cao_blogr/templates/home.jinja2 @@ -159,7 +159,7 @@
-
+

diff --git a/cao_blogr/views/default.py b/cao_blogr/views/default.py index aa946c6..95d1efe 100644 --- a/cao_blogr/views/default.py +++ b/cao_blogr/views/default.py @@ -53,7 +53,7 @@ def home(request): response = request.params['response'] # verification reCaptcha ? - ok, erreur = captcha_verify(response, request.remote_addr) + ok, erreur = captcha_validate(response, request.remote_addr, request.registry.settings['secret_key']) if ok and comments != '': # no, message is not spam, send it body = """ @@ -72,7 +72,7 @@ webmaster@meditation-sunyata.paris """.format(name, email, comments) message = Message(subject="[MSParis] Message de contact", - sender=request.registry.settings['cao_blogr.admin_email'], + sender=request.registry.settings['admin_email'], body=body) message.add_recipient('phuoc@caotek.fr') mailer = request.registry['mailer'] @@ -87,12 +87,13 @@ webmaster@meditation-sunyata.paris 'name': name, 'email': email, 'comments': comments, + 'site_key' : request.registry.settings['site_key'], } -def captcha_verify(response, remote_addr): +def captcha_validate(response, remote_addr, secret): VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify' data = { - 'secret': '6LeDvVUgAAAAAGASZXCmcmhh-KtBWTZjXpLpKdNt', + 'secret': secret, 'response': response, 'remoteip': remote_addr, } diff --git a/development.ini b/development.ini index 653dfec..77fc0e6 100644 --- a/development.ini +++ b/development.ini @@ -18,11 +18,15 @@ sqlalchemy.url = sqlite:///%(here)s/cao_blogr.sqlite # images location images_dir = /pyramid10/cao_sunyata/cao_blogr/static/img/ +# reCaptcha keys +site_key = 6LeDvVUgAAAAAOqD_-h93kd5aW8CmpeVvKYu-m0p +secret_key = 6LeDvVUgAAAAAGASZXCmcmhh-KtBWTZjXpLpKdNt + # Mailer configuration # cao_blogr.admin_email = cao.thien-phuoc@orange.fr # mail.host = smtp.orange.fr # mail.port = 25 -cao_blogr.admin_email = phuoc@caotek.fr +admin_email = phuoc@caotek.fr mail.host = smtp.gmail.com mail.port = 465 mail.ssl = True diff --git a/production.ini b/production.ini index ad3d78f..de2cc93 100644 --- a/production.ini +++ b/production.ini @@ -19,7 +19,7 @@ images_dir = /pyramid10/cao_sunyata/cao_blogr/static/img/ # Mailer configuration # mail.host = localhost # mail.port = 25 -cao_blogr.admin_email = phuoc@caotek.fr +admin_email = phuoc@caotek.fr mail.host = smtp.gmail.com mail.port = 465 mail.ssl = True