diff options
Diffstat (limited to 'app/dispatch')
| -rw-r--r-- | app/dispatch/middleware.py | 20 | ||||
| -rw-r--r-- | app/dispatch/templates/dispatch/invite_email.txt | 7 | ||||
| -rw-r--r-- | app/dispatch/templates/registration/activation_complete.html | 8 | ||||
| -rw-r--r-- | app/dispatch/templates/registration/activation_email.txt | 9 |
4 files changed, 35 insertions, 9 deletions
diff --git a/app/dispatch/middleware.py b/app/dispatch/middleware.py index 8ae0465..a3b9ec6 100644 --- a/app/dispatch/middleware.py +++ b/app/dispatch/middleware.py @@ -1,9 +1,13 @@ from django.http import HttpResponseRedirect from django.conf import settings -from re import compile -from django.core.urlresolvers import reverse +import re +from django.core.urlresolvers import reverse, reverse_lazy -EXEMPT_URLS = [reverse('login'),reverse('logout')] +EXEMPT_URLS = [ + reverse('login'), + reverse('logout'), + ] +EXEMPT_REGEX = re.compile('^/accounts/.*$') if hasattr(settings, 'LOGIN_EXEMPT_URLS'): EXEMPT_URLS += settings.LOGIN_EXEMPT_URLS @@ -24,7 +28,10 @@ class LoginRequiredMiddleware(object): def __call__(self, request): if not request.user or not request.user.is_authenticated(): path = request.path_info - if path not in EXEMPT_URLS: + # Check for any regex matches + reg = EXEMPT_REGEX.match(path) + + if path not in EXEMPT_URLS and reg is None: login_uri = '%s?next=%s' % (settings.LOGIN_URL, request.path_info) return HttpResponseRedirect(login_uri) else: @@ -40,8 +47,3 @@ class LoginRequiredMiddleware(object): return HttpResponseRedirect(allowed_paths[0]) return self.get_response(request) - - - # TODO: Have the middleware automatically set the default identity - # if not set and a superuser creates one - diff --git a/app/dispatch/templates/dispatch/invite_email.txt b/app/dispatch/templates/dispatch/invite_email.txt new file mode 100644 index 0000000..eb888a6 --- /dev/null +++ b/app/dispatch/templates/dispatch/invite_email.txt @@ -0,0 +1,7 @@ +Hi {{name}}, + +You've been invited by {{user.first_name}} to register + +Please click the following link to start this process + +{{site}}{% url 'registration_register' %} diff --git a/app/dispatch/templates/registration/activation_complete.html b/app/dispatch/templates/registration/activation_complete.html index 6f8929e..3400219 100644 --- a/app/dispatch/templates/registration/activation_complete.html +++ b/app/dispatch/templates/registration/activation_complete.html @@ -7,8 +7,16 @@ <div class="col s12"> <p> Your Account activation was successful! + <br> + You will be redirected to the sign in page momentarily, if not <a href="{% url 'login' %}">click here</a> </p> </div> </div> +<script> +setTimeout(function () { + window.location.href = "/login"; +}, 2000); +</script> + {% endblock %} diff --git a/app/dispatch/templates/registration/activation_email.txt b/app/dispatch/templates/registration/activation_email.txt index 66b7b05..408cf77 100644 --- a/app/dispatch/templates/registration/activation_email.txt +++ b/app/dispatch/templates/registration/activation_email.txt @@ -1,4 +1,13 @@ +Hi {{user.first_name}}, + +Please click the following link to activate your account: + +http://{{site}}{% url 'registration_activate' activation_key %} + + +{% if False %} Activation key: {{activation_key}} Site: {{site}} Expiration date: {{expiration_days}} User model {{user}} +{% endif %} |
