Kill recap and akis.
parent
26560fdc22
commit
e674d88605
|
@ -1,10 +1,8 @@
|
|||
AKISMET_KEY = ''
|
||||
CSRF_COOKIE_SECURE = False
|
||||
DEBUG = True
|
||||
INTERCOM_SECRET_KEY = ''
|
||||
POSTMARK_API_KEY = ''
|
||||
RAVEN_CONFIG = {'dsn': ''}
|
||||
RECAPTCHA_SECRET = ''
|
||||
SECRET_KEY = 'changeme'
|
||||
SESSION_COOKIE_SECURE = False
|
||||
SSLIFY_DISABLE = False
|
||||
|
|
|
@ -155,23 +155,6 @@ class SniptValidation(Validation):
|
|||
if (len(bundle.data['title']) > 255):
|
||||
errors = 'Title must be 255 characters or less.'
|
||||
|
||||
akismet_url = 'https://{}.rest.akismet.com/1.1/comment-check'.format(
|
||||
settings.AKISMET_KEY)
|
||||
blog = 'https://snipt.net'
|
||||
user_ip = bundle.request.META.get('REMOTE_ADDR')
|
||||
comment_content = bundle.obj.code
|
||||
|
||||
payload = {
|
||||
'blog': blog,
|
||||
'user_ip': user_ip,
|
||||
'comment_content': comment_content
|
||||
}
|
||||
r = requests.post(akismet_url,
|
||||
data=payload)
|
||||
|
||||
if r.text == 'true':
|
||||
errors = 'This snipt looks like spam. If you believe that your snipt is not spam, please email support@snipt.net.'
|
||||
|
||||
return errors
|
||||
|
||||
|
||||
|
|
|
@ -65,8 +65,6 @@
|
|||
<script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
<script src="https://www.google.com/recaptcha/api.js"></script>
|
||||
|
||||
</head>
|
||||
<body class="{% block body-class %}{% endblock %} is-pro" ng-controller="AppController">
|
||||
|
||||
|
|
|
@ -73,7 +73,6 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-left: 180px;" class="g-recaptcha" data-sitekey="6LerYA0TAAAAAFJaMf7JMnlQR2wzqd_3dMRvLd-4"></div>
|
||||
<div class="form-actions group">
|
||||
<a class="btn pull-right" href="/login/">Log in</a>
|
||||
<button class="btn btn-primary" type="submit">Sign up</button>
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
import requests
|
||||
|
||||
from django.conf import settings
|
||||
from django.http import HttpResponse
|
||||
from registration.backends.default.views import RegistrationView
|
||||
from utils.forms import SniptRegistrationForm
|
||||
|
||||
|
@ -13,19 +9,6 @@ class SniptRegistrationView(RegistrationView):
|
|||
form_class = SniptRegistrationForm
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
|
||||
if request.method == 'POST':
|
||||
payload = {
|
||||
'secret': settings.RECAPTCHA_SECRET,
|
||||
'response': request.POST['g-recaptcha-response'],
|
||||
'remoteip': request.META.get('REMOTE_ADDR')
|
||||
}
|
||||
r = requests.post('https://www.google.com/recaptcha/api/siteverify',
|
||||
data=payload)
|
||||
|
||||
if not r.json()['success']:
|
||||
return HttpResponse('You failed the robot check. Go back and try again.')
|
||||
|
||||
return super(RegistrationView, self).dispatch(request, *args, **kwargs)
|
||||
|
||||
def get_success_url(self, request, user):
|
||||
|
|
Loading…
Reference in New Issue