Commit d24e180a authored by Claude Paroz's avatar Claude Paroz

Updated MIDDLEWARE_CLASSES, use new get_current_site

parent 04735474
......@@ -101,7 +101,7 @@ def site_register(request):
if request.method == 'POST':
form = RegistrationForm(data = request.POST)
if form.is_valid():
new_user = form.save()
new_user = form.save(request)
return HttpResponseRedirect(reverse('register_success'))
else:
form = RegistrationForm()
......
......@@ -113,7 +113,9 @@ MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ATOMIC_REQUESTS = True
......@@ -151,7 +153,7 @@ LOGIN_REDIRECT_URL = '/'
ADMIN_GROUP = ''
try:
from local_settings import *
from .local_settings import *
except ImportError:
pass
......
......@@ -3,7 +3,7 @@ import hashlib, random
from django import forms
from django.conf import settings
from django.contrib.sites.models import Site
from django.contrib.sites.shortcuts import get_current_site
from django.core.urlresolvers import reverse
from django.utils.encoding import force_bytes
from django.utils.translation import ugettext_lazy, ugettext as _
......@@ -57,7 +57,7 @@ class RegistrationForm(forms.Form):
raise forms.ValidationError(_(u'The passwords do not match'))
return cleaned_data
def save(self):
def save(self, request):
""" Create the user """
username = self.cleaned_data['username']
email = self.cleaned_data['email']
......@@ -77,7 +77,7 @@ class RegistrationForm(forms.Form):
new_user.save()
# Send activation email
from django.core.mail import send_mail
current_site = Site.objects.get_current()
current_site = get_current_site(request)
subject = settings.EMAIL_SUBJECT_PREFIX + _(u'Account activation')
message = _(u"This is a confirmation that your registration on %s succeeded. To activate your account, please click on the link below or copy and paste it in a browser.") % current_site.name
message += "\n\nhttps://%s%s\n\n" % (current_site.domain, str(reverse("register_activation", kwargs={'key': activation_key})))
......
......@@ -24,7 +24,7 @@ from django.conf.locale import LANG_INFO
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import PasswordChangeForm
from django.contrib import messages
from django.contrib.sites.models import Site
from django.contrib.sites.shortcuts import get_current_site
from django.core import urlresolvers
from django.db import IntegrityError
from django.http import HttpResponseRedirect
......@@ -100,7 +100,7 @@ def person_team_join(request):
messages.success(request, _("You have successfully joined the team '%s'.") % team.get_description())
team.send_mail_to_coordinator(subject=ugettext_lazy("A new person joined your team"),
message=ugettext_lazy("%(name)s has just joined your translation team on %(site)s"),
messagekw = {'name': person.name, 'site': Site.objects.get_current()})
messagekw = {'name': person.name, 'site': get_current_site(request)})
except IntegrityError:
messages.info(request, _("You are already member of this team."))
else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment