diff --git a/src/postorius/templates/postorius/menu/list_nav.html b/src/postorius/templates/postorius/menu/list_nav.html
index 333cbf1..8eb2721 100644
--- a/src/postorius/templates/postorius/menu/list_nav.html
+++ b/src/postorius/templates/postorius/menu/list_nav.html
@@ -15,7 +15,7 @@
{% if user.is_superuser or user.is_list_owner %}
{% trans "Settings" %}
{% endif %}
- {% if user.is_superuser or user.is_list_owner or user.is_list_moderator %}
+ {% if user.is_superuser or user.is_list_owner %}
{% trans "Mass Subscribe" %}
{% endif %}
{% if user.is_superuser or user.is_list_owner %}
diff --git a/src/postorius/views/list.py b/src/postorius/views/list.py
index 606d62e..bfdb4f5 100644
--- a/src/postorius/views/list.py
+++ b/src/postorius/views/list.py
@@ -22,6 +22,8 @@
from django.contrib.auth.decorators import (login_required,
user_passes_test)
from django.core.urlresolvers import reverse
+from django.core.validators import validate_email
+from django.core.exceptions import ValidationError
from django.shortcuts import render_to_response, redirect
from django.template import RequestContext
from django.utils.decorators import method_decorator
@@ -249,22 +251,20 @@
else:
emails = request.POST["emails"].splitlines()
for email in emails:
- parts = email.split('@')
- if len(parts) != 2 or '.' not in parts[1]:
+ try:
+ validate_email(email)
+ self.mailing_list.subscribe(address=email)
+ messages.success(request,
+ 'The address %s has been subscribed to %s.' %
+ (email, self.mailing_list.fqdn_listname))
+ except MailmanApiError:
+ return utils.render_api_error(request)
+ except HTTPError, e:
+ messages.error(request, e)
+ except ValidationError:
messages.error(request,
'The email address %s is not valid.' %
email)
- else:
- try:
- self.mailing_list.subscribe(address=email)
- messages.success(
- request,
- 'The address %s has been subscribed to %s.' %
- (email, self.mailing_list.fqdn_listname))
- except MailmanApiError:
- return utils.render_api_error(request)
- except HTTPError, e:
- messages.error(request, e)
return redirect('mass_subscribe', self.mailing_list.list_id)