diff --git a/auth/rest_auth.py b/auth/rest_auth.py
deleted file mode 100644
index 8be3711..0000000
--- a/auth/rest_auth.py
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (C) 1998-2010 by the Free Software Foundation, Inc.
-#
-# This file is part of GNU Mailman.
-#
-# GNU Mailman is free software: you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free
-# Software Foundation, either version 3 of the License, or (at your option)
-# any later version.
-#
-# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-# more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# GNU Mailman. If not, see .
-
-# https://docs.djangoproject.com/en/dev/topics/auth/
-
-from django.contrib.auth.models import User, check_password
-
-class SettingsBackend:
- """
- Authenticate against the settings the REST Middleware
- checking permissions ...
-
- Development uses hardcoded users atm.
-
- """
-
- supports_object_permissions = False
- supports_anonymous_user = False
- supports_inactive_user = False
-
- valid_users = {"james@example.com": "james",
- "katie@example.com": "katie",
- "kevin@example.com": "kevin"}
-
- def authenticate(self, username=None, password=None):
- login_valid = username in valid_users.keys()
- try:
- pwd_valid = check_password(password, valid_users["username"])
- except KeyError:
- pwd_valid = False
- if login_valid and pwd_valid:
- try:
- user = User.objects.get(username=username)
- except User.DoesNotExist:
- # Create a new user. Note that we can set password
- # to anything, because it won't be checked; the password
- # from settings.py will.
- user = User(username=username, password='get from settings.py')
- user.is_staff = False
- user.is_superuser = False
- user.save()
- return user
- return None
-
- def get_user(self, user_id):
- try:
- return User.objects.get(pk=user_id)
- except User.DoesNotExist:
- return None
-
- def has_perm(self, user_obj, perm):
- if user_obj.username == "james@example.com":
- return True
- else:
- return False
diff --git a/auth/restbackend.py b/auth/restbackend.py
new file mode 100644
index 0000000..a59bebf
--- /dev/null
+++ b/auth/restbackend.py
@@ -0,0 +1,69 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 1998-2010 by the Free Software Foundation, Inc.
+#
+# This file is part of GNU Mailman.
+#
+# GNU Mailman is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# GNU Mailman. If not, see .
+
+# https://docs.djangoproject.com/en/dev/topics/auth/
+
+from django.contrib.auth.models import User, check_password
+
+class RESTBackend:
+ """
+ Authenticate against the settings the REST Middleware
+ checking permissions ...
+
+ Development uses hardcoded users atm.
+
+ """
+
+ supports_object_permissions = False
+ supports_anonymous_user = False
+ supports_inactive_user = False
+
+ def authenticate(self, username=None, password=None):
+ valid_users = {"james@example.com": "james", #workaround until middleware exists
+ "katie@example.com": "katie",
+ "kevin@example.com": "kevin"}
+ login_valid = username in valid_users.keys()
+ try:
+ pwd_valid = check_password(password, valid_users["username"])
+ except KeyError:
+ pwd_valid = False
+ if login_valid and pwd_valid:
+ try:
+ user = User.objects.get(username=username)
+ except User.DoesNotExist:
+ # Create a new user. Note that we can set password
+ # to anything, because it won't be checked; the password
+ # from settings.py will.
+ user = User(username=username, password='get from settings.py')
+ user.is_staff = False
+ user.is_superuser = False
+ user.save()
+ return user
+ return None
+
+ def get_user(self, user_id):
+ try:
+ return User.objects.get(pk=user_id)
+ except User.DoesNotExist:
+ return None
+
+ def has_perm(self, user_obj, perm):
+ if user_obj.username == "james@example.com":
+ return True
+ else:
+ return False
diff --git a/forms.py b/forms.py
index aa63840..04aa37c 100644
--- a/forms.py
+++ b/forms.py
@@ -850,13 +850,13 @@
class Login(FieldsetForm):
"""Form fields to let the user log in.
"""
- addr = forms.EmailField(
+ user = forms.EmailField(
label = _('Email address'),
error_messages = {'required': _('Please enter an email address.'),
'invalid': _('Please enter a valid email address.')},
required = True,
)
- psw = forms.CharField(
+ password = forms.CharField(
label = _('Password'),
widget = forms.PasswordInput,
error_messages = {'required': _('Please enter your password.'),
@@ -869,7 +869,7 @@
Class to define the name of the fieldsets and what should be
included in each.
"""
- layout = [["Login", "addr", "psw"],]
+ layout = [["Login", "user", "password"],]
class ListMassSubscription(FieldsetForm):
"""Form fields to masssubscribe users to a list.
diff --git a/templates/mailman-django/base.html b/templates/mailman-django/base.html
index 684401c..3f238e5 100644
--- a/templates/mailman-django/base.html
+++ b/templates/mailman-django/base.html
@@ -45,7 +45,7 @@
diff --git a/templates/mailman-django/login.html b/templates/mailman-django/login.html
index b448eb8..234bf64 100644
--- a/templates/mailman-django/login.html
+++ b/templates/mailman-django/login.html
@@ -6,11 +6,7 @@
{% endblock %}
{% block header %}
-
-
-
{% trans "You are required to login to continue. Please provide a valid email address and a password." %}
-
-