Permalink
Browse files

signup captcha

  • Loading branch information...
1 parent c2c8dad commit 0231a038049d6483dd3cc7dbaddb4fc345971df8 @loddit loddit committed Mar 9, 2012
Showing with 9 additions and 9 deletions.
  1. +6 −7 apps/core/views.py
  2. +1 −1 apps/member/views.py
  3. +1 −1 templates/core/submit_topic.html
  4. +1 −0 templates/member/signup.html
View
@@ -204,25 +204,24 @@ def submit_topic(request):
context,
context_instance=RequestContext(request))
- if request.method == 'POST' and request.POST['title'] == '':
+ if request.method == 'POST' :
form = ArticleForm(request.POST)
topic = form.save(commit=False)
- topic.set_author(request.user)
- topic.save()
- topic.send_notification_mail('created')
+ if request.POST['captcha'] == '':
+ topic = form.save(commit=False)
+ topic.set_author(request.user)
+ topic.save()
+ #topic.send_notification_mail('created')
context = {
'form': form,
- 'topic': topic,
'save_success': True
}
return render_to_response('core/submit_topic.html',
context,
context_instance=RequestContext(request))
- else:
- return HttpResponseForbidden()
@login_required
def edit_topic(request, id):
View
@@ -32,7 +32,7 @@ def logout(request):
return HttpResponseRedirect('/')
def signup(request):
- if request.method == 'POST':
+ if request.method == 'POST' and request.POST['captcha'] == '':
form = SignupForm(request.POST)
if form.save():
ctx = { 'email': form.cleaned_data['email'], }
@@ -51,7 +51,7 @@
<td>{{form.in_event}}</td>
</tr>
</table>
- <input type="text" name="title" >
+ <input type="text" name="captcha" style="display:none">
<input type="submit" value="提交">
</form>
{% endif %}
@@ -27,6 +27,7 @@
{{ form.password2 }}
</p>
{{ form.non_field_errors }}
+ <input type="text" name="captcha" style="display:none">
<input type="submit" value="提交注册" tabindex="5"/>
</form>
<div id="signup-guide">

0 comments on commit 0231a03

Please sign in to comment.