def signup(request): if request.user.is_authenticated(): return HttpResponseRedirect(request.user.get_absolute_url()) if request.method == 'POST': form = forms.SignupForm(request.POST) if form.is_valid(): form.save() api.login(request, form.cleaned_data.get('username'), form.cleaned_data.get('password')) url = request.user.get_absolute_url() return HttpResponseRedirect(url + '?new=1') else: form = forms.SignupForm() return render_to_response( 'occupywallst/signup.html', {'form': form}, context_instance=RequestContext(request))
def signup(request): if request.user.is_authenticated(): return HttpResponseRedirect(request.user.get_absolute_url()) if request.method == 'POST': form = forms.SignupForm(request.POST) if form.is_valid(): key = 'signup_' + request.META['REMOTE_ADDR'] if cache.get(key): return HttpResponse('please wait before signing up again') cache.set(key, True, settings.OWS_LIMIT_SIGNUP) form.save() api.login(request, form.cleaned_data.get('username'), form.cleaned_data.get('password')) url = request.user.get_absolute_url() return HttpResponseRedirect(url + '?new=1') else: form = forms.SignupForm() return render_to_response('occupywallst/signup.html', {'form': form}, context_instance=RequestContext(request))
def signup(request): if request.user.is_authenticated(): return HttpResponseRedirect(request.user.get_absolute_url()) if request.method == 'POST': form = forms.SignupForm(request.POST) if form.is_valid(): key = 'signup_' + request.META['REMOTE_ADDR'] if cache.get(key): return HttpResponse('please wait before signing up again') cache.set(key, True, settings.OWS_LIMIT_SIGNUP) form.save() api.login(request, form.cleaned_data.get('username'), form.cleaned_data.get('password')) url = request.user.get_absolute_url() return HttpResponseRedirect(url + '?new=1') else: form = forms.SignupForm() return render_to_response( 'occupywallst/signup.html', {'form': form}, context_instance=RequestContext(request))