forked from expo/troggle
3rd attempt at getting the right syntax for the CSRF protection in
This commit is contained in:
parent
f90b6dc7ab
commit
c362b1b529
@ -16,7 +16,7 @@ from registration.models import RegistrationProfile
|
|||||||
# in the HTML. Your mileage may vary. If/when Django ticket #3515
|
# in the HTML. Your mileage may vary. If/when Django ticket #3515
|
||||||
# lands in trunk, this will no longer be necessary.
|
# lands in trunk, this will no longer be necessary.
|
||||||
# This was fixed in 2007, so I guess we don't need this any more. [W]
|
# This was fixed in 2007, so I guess we don't need this any more. [W]
|
||||||
#attrs_dict = { 'class': 'required' }
|
attrs_dict = { 'class': 'required' }
|
||||||
|
|
||||||
|
|
||||||
class RegistrationForm(forms.Form):
|
class RegistrationForm(forms.Form):
|
||||||
|
@ -7,13 +7,11 @@ from django.contrib.auth import authenticate
|
|||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
from django.core.context_processors import csrf
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render_to_response
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
from django.contrib.auth import login
|
from django.contrib.auth import login
|
||||||
#Add CSRF protection:
|
|
||||||
from django.core.context_processors import csrf
|
|
||||||
from django.shortcuts import render_to_response
|
|
||||||
|
|
||||||
from registration.forms import RegistrationForm
|
from registration.forms import RegistrationForm
|
||||||
from registration.models import RegistrationProfile
|
from registration.models import RegistrationProfile
|
||||||
@ -82,9 +80,9 @@ def activate(request, activation_key,
|
|||||||
for key, value in extra_context.items():
|
for key, value in extra_context.items():
|
||||||
context[key] = callable(value) and value() or value
|
context[key] = callable(value) and value() or value
|
||||||
return render_to_response(template_name,
|
return render_to_response(template_name,
|
||||||
{ 'account': account,
|
c.update({ 'account': account,
|
||||||
'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS, 'settings':settings},
|
'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS, 'settings':settings}),
|
||||||
context_instance=context, c)
|
context_instance=context,)
|
||||||
|
|
||||||
|
|
||||||
def register(request, success_url=None,
|
def register(request, success_url=None,
|
||||||
@ -168,5 +166,5 @@ def register(request, success_url=None,
|
|||||||
for key, value in extra_context.items():
|
for key, value in extra_context.items():
|
||||||
context[key] = callable(value) and value() or value
|
context[key] = callable(value) and value() or value
|
||||||
return render_to_response(template_name,
|
return render_to_response(template_name,
|
||||||
{ 'form': form,'settings':settings },
|
c.update({ 'form': form,'settings':settings }),
|
||||||
context_instance=context, c)
|
context_instance=context)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user