Recaptcha for teams signup.
parent
14a7cfd6e1
commit
2aaf20b42b
|
@ -3,6 +3,7 @@ DEBUG = True
|
||||||
INTERCOM_SECRET_KEY = ''
|
INTERCOM_SECRET_KEY = ''
|
||||||
POSTMARK_API_KEY = ''
|
POSTMARK_API_KEY = ''
|
||||||
RAVEN_CONFIG = {'dsn': ''}
|
RAVEN_CONFIG = {'dsn': ''}
|
||||||
|
RECAPTCHA_SECRET = ''
|
||||||
SECRET_KEY = 'changeme'
|
SECRET_KEY = 'changeme'
|
||||||
SESSION_COOKIE_SECURE = False
|
SESSION_COOKIE_SECURE = False
|
||||||
SSLIFY_DISABLE = False
|
SSLIFY_DISABLE = False
|
||||||
|
|
|
@ -65,6 +65,8 @@
|
||||||
<script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
<script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
|
||||||
|
<script src="https://www.google.com/recaptcha/api.js"></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body class="{% block body-class %}{% endblock %} {% if request.user.profile.is_pro %}is-pro{% endif %}" ng-controller="AppController">
|
<body class="{% block body-class %}{% endblock %} {% if request.user.profile.is_pro %}is-pro{% endif %}" ng-controller="AppController">
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<div class="info">
|
<div class="info">
|
||||||
You rock.
|
You rock.
|
||||||
<p class="sub" style="padding: 0 120px;">
|
<p class="sub" style="padding: 0 120px;">
|
||||||
We'll email you to arrange the beta program payment of $49, and help you get your first team created!<br /><br />
|
We'll email you to get more information about your team and to help you get your first team created.
|
||||||
If you ever need anything at all, <a href="mailto:support@snipt.net">email support</a>, or use the chat in the bottom right.
|
If you ever need anything at all, <a href="mailto:support@snipt.net">email support</a>, or use the chat in the bottom right.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
You've successfully applied for the beta program - we'll email you as soon as we're ready!
|
You've successfully applied for the beta program - we'll email you as soon as we're ready!
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<form class="form-horizontal static-box" id="pro-signup" method="post" action="/for-teams/complete/">
|
<form class="form-horizontal static-box" id="teams-signup" method="post" action="/for-teams/complete/">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
Snipt for Teams
|
Snipt for Teams
|
||||||
|
@ -59,6 +59,7 @@
|
||||||
<textarea required name="info" name="info" id="info" class="input-xlarge" style="height: 100px;"></textarea>
|
<textarea required name="info" name="info" id="info" class="input-xlarge" style="height: 100px;"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div style="margin-left: 180px;" class="g-recaptcha" data-sitekey="6LerYA0TAAAAAFJaMf7JMnlQR2wzqd_3dMRvLd-4"></div>
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<button type="submit" class="btn btn-success">Request more info »</button>
|
<button type="submit" class="btn btn-success">Request more info »</button>
|
||||||
|
|
12
views.py
12
views.py
|
@ -2,6 +2,7 @@ import datetime
|
||||||
import hashlib
|
import hashlib
|
||||||
import os
|
import os
|
||||||
import stripe
|
import stripe
|
||||||
|
import requests
|
||||||
|
|
||||||
from accounts.models import UserProfile
|
from accounts.models import UserProfile
|
||||||
from annoying.decorators import ajax_request, render_to
|
from annoying.decorators import ajax_request, render_to
|
||||||
|
@ -33,6 +34,17 @@ def for_teams_complete(request):
|
||||||
|
|
||||||
if request.method == 'POST':
|
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 HttpResponseBadRequest()
|
||||||
|
|
||||||
if request.user.is_authenticated():
|
if request.user.is_authenticated():
|
||||||
name = request.POST['name']
|
name = request.POST['name']
|
||||||
members = request.POST['members']
|
members = request.POST['members']
|
||||||
|
|
Loading…
Reference in New Issue