Commit d8349006 authored by Leonidas Poulopoulos's avatar Leonidas Poulopoulos

Add multiple email field. This closes #3447

 - Add multiple email field to tacke multiple emails via SAML
 - Made appropriate changes to activation functions
 - Made changes to activation form
parent a5cbe52f
......@@ -78,7 +78,7 @@ def activate(request, activation_key):
{"site": Site.objects.get_current(),
"user": account})
send_mail(_("%sUser account activated") % settings.EMAIL_SUBJECT_PREFIX,
email, settings.SERVER_EMAIL, [])
email, settings.SERVER_EMAIL,';'))
context = RequestContext(request)
return render_to_response("registration/activate.html",
{ 'account': account,
from django import forms
from django.core.validators import email_re
class MultipleEmailsField(forms.Field):
def clean(self, value):
Check that the field contains one or more semicolon-separated emails
and normalizes the data to a list of the email strings.
if not value:
raise forms.ValidationError('Enter at least one e-mail address. Multiple email addresses Should be separated with semicolon (;)')
emails = value.split(';')
for email in emails:
if not email_re.match(email):
raise forms.ValidationError('%s is not a valid e-mail address.' % email)
# Always return the cleaned data.
return ';'.join(emails)
\ No newline at end of file
......@@ -4,7 +4,7 @@ from django.utils.translation import ugettext_lazy
from edumanage.models import *
from accounts.models import *
from django.conf import settings
from edumanage.fields import MultipleEmailsField
from django.contrib.contenttypes.generic import BaseGenericInlineFormSet
import ipaddr
......@@ -28,7 +28,7 @@ class InstRealmMonForm(forms.ModelForm):
class UserProfileForm(forms.ModelForm):
email = forms.EmailField(required=True)
email = MultipleEmailsField(required=True)
class Meta:
model = UserProfile
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