Commit 55e9bed8 authored by root's avatar root
Browse files

Merge branch 'devel-0.13' of https://code.grnet.gr/git/astakos into devel-0.13

parents 46711069 592eb503
......@@ -43,6 +43,7 @@ from astakos.im.functions import (
from astakos.im.settings import (
INVITATIONS_ENABLED, MODERATION_ENABLED, RE_USER_EMAIL_PATTERNS
)
from astakos.im.forms import *
import astakos.im.messages as astakos_messages
......
......@@ -112,7 +112,7 @@ def _get_user_by_email(email):
if not email:
raise BadRequest('Email missing')
try:
user = AstakosUser.objects.get(email=email)
user = AstakosUser.objects.get(email__iexact=email)
except AstakosUser.DoesNotExist:
raise ItemNotFound('Invalid email')
......
......@@ -48,7 +48,7 @@ class TokenBackend(ModelBackend):
"""
def authenticate(self, email=None, auth_token=None):
try:
user = AstakosUser.objects.get(email=email, is_active=True)
user = AstakosUser.objects.get(email__iexact=email, is_active=True)
if user.auth_token == auth_token:
return user
except AstakosUser.DoesNotExist:
......@@ -74,7 +74,7 @@ class EmailBackend(ModelBackend):
def authenticate(self, username=None, password=None):
#If username is an email address, then try to pull it up
if email_re.search(username):
users = AstakosUser.objects.filter(email=username)
users = AstakosUser.objects.filter(email__iexact=username)
if not users:
return None
for user in users:
......
......@@ -293,7 +293,7 @@ class ShibbolethUserCreationForm(ThirdPartyUserCreationForm):
if self.instance:
if self.instance.email == email:
raise forms.ValidationError(_("This is your current email."))
for user in AstakosUser.objects.filter(email=email):
for user in AstakosUser.objects.filter(email__iexact=email):
if user.provider == 'shibboleth':
raise forms.ValidationError(_(
"This email is already associated with another \
......@@ -452,7 +452,7 @@ class ExtendedPasswordResetForm(PasswordResetForm):
def clean_email(self):
email = super(ExtendedPasswordResetForm, self).clean_email()
try:
user = AstakosUser.objects.get(email=email, is_active=True)
user = AstakosUser.objects.get(email__iexact=email, is_active=True)
if not user.has_usable_password():
raise forms.ValidationError(_(astakos_messages.UNUSABLE_PASSWORD))
except AstakosUser.DoesNotExist:
......
......@@ -47,7 +47,7 @@ def get_user(email_or_id, **kwargs):
if email_or_id.isdigit():
return AstakosUser.objects.get(id=int(email_or_id))
else:
return AstakosUser.objects.get(email=email_or_id, **kwargs)
return AstakosUser.objects.get(email__iexact=email_or_id, **kwargs)
except AstakosUser.DoesNotExist, AstakosUser.MultipleObjectsReturned:
return None
......
......@@ -50,7 +50,7 @@ class Command(BaseCommand):
if email_or_id.isdigit():
users = AstakosUser.objects.filter(id=int(email_or_id))
else:
users = AstakosUser.objects.filter(email=email_or_id)
users = AstakosUser.objects.filter(email__iexact=email_or_id)
if users.count() == 0:
field = 'id' if email_or_id.isdigit() else 'email'
msg = "Unknown user with %s '%s'" % (field, email_or_id)
......
......@@ -525,7 +525,7 @@ class AstakosUser(User):
def conflicting_email(self):
q = AstakosUser.objects.exclude(username=self.username)
q = q.filter(email=self.email)
q = q.filter(email__iexact=self.email)
if q.count() != 0:
return True
return False
......@@ -712,7 +712,7 @@ class EmailChangeManager(models.Manager):
raise EmailChange.DoesNotExist
# is there an active user with this address?
try:
AstakosUser.objects.get(email=email_change.new_email_address)
AstakosUser.objects.get(email__iexact=email_change.new_email_address)
except AstakosUser.DoesNotExist:
pass
else:
......
......@@ -81,9 +81,10 @@ loggers = {
static_files = {'astakos.im': ''}
# The following settings will replace the default django settings
AUTHENTICATION_BACKENDS = ('django_auth_ldap.backend.LDAPBackend',
'astakos.im.auth_backends.EmailBackend',
'astakos.im.auth_backends.TokenBackend')
AUTHENTICATION_BACKENDS = (
# 'django_auth_ldap.backend.LDAPBackend',
'astakos.im.auth_backends.EmailBackend',
'astakos.im.auth_backends.TokenBackend')
LOGIN_URL = '/im'
CUSTOM_USER_MODEL = 'astakos.im.AstakosUser'
......
--- A translation in English follows ---
Έχει δημιουργηθεί ο παρακάτω λογαριασμός:
Email: {{user.email}}
First name: {{user.first_name}}
Last name: {{user.last_name}}
Is active: {{user.is_active}}
Level: {{user.level}}
Invitations: {{user.invitations}}
Για την ενεργοποίησή του μπορείτε να χρησιμοποιήσετε το command line εργαλείο snf-manage sendactivation
--
The following account has been created:
Email: {{user.email}}
First name: {{user.first_name}}
Last name: {{user.last_name}}
Is active: {{user.is_active}}
Level: {{user.level}}
Invitations: {{user.invitations}}
For its activation you can use the command line tool snf-manage sendactivation
......@@ -79,7 +79,6 @@ def monthssince(joined_date):
@register.filter
def lookup(d, key):
print d, key
return d.get(key)
@register.filter
......
......@@ -406,6 +406,7 @@ def signup(request, template_name='im/signup.html', on_success='im/signup_comple
transaction.commit()
return response
messages.add_message(request, status, message)
transaction.commit()
return render_response(
on_success,
context_instance=get_context(
......
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