diff options
author | Aurélien Bompard <aurelien@bompard.org> | 2013-02-13 12:25:37 +0100 |
---|---|---|
committer | Aurélien Bompard <aurelien@bompard.org> | 2013-02-13 12:25:37 +0100 |
commit | a5404362a09e598e85fa121c5859cfee315495da (patch) | |
tree | e1d80e5f03d424657a3bf999b8c69dc6f7204232 /hyperkitty | |
parent | 470007dc4fd539aef3437f9763046e0fd75ce852 (diff) | |
download | hyperkitty-a5404362a09e598e85fa121c5859cfee315495da.tar.gz hyperkitty-a5404362a09e598e85fa121c5859cfee315495da.tar.xz hyperkitty-a5404362a09e598e85fa121c5859cfee315495da.zip |
Make it possible to disable the internal user DB
Diffstat (limited to 'hyperkitty')
-rw-r--r-- | hyperkitty/templates/base.html | 10 | ||||
-rw-r--r-- | hyperkitty/templates/login.html | 2 | ||||
-rw-r--r-- | hyperkitty/views/accounts.py | 3 |
3 files changed, 11 insertions, 4 deletions
diff --git a/hyperkitty/templates/base.html b/hyperkitty/templates/base.html index 85b044e..93e0a6c 100644 --- a/hyperkitty/templates/base.html +++ b/hyperkitty/templates/base.html @@ -23,11 +23,13 @@ <ul class="nav auth"> {% if user.is_authenticated %} - <li><a class="mm_logout" href="{% url user_logout %}">Logout</a></li> - <li><a href="{% url user_profile %}">{{ user.username }}</a></li> + <li><a class="mm_logout" href="{% url user_logout %}">Logout</a></li> + <li><a href="{% url user_profile %}">{{ user.username }}</a></li> {% else %} - <li><a class="mm_user" href="{% url user_login %}?next={{next|default:request.path|urlencode}}">Login</a></li> - <li><a href="{% url user_registration %}?next={{next|default:request.path|urlencode}}"> Sign Up </a></li> + <li><a class="mm_user" href="{% url user_login %}?next={{next|default:request.path|urlencode}}">Login</a></li> + {% if use_internal_auth %} + <li><a href="{% url user_registration %}?next={{next|default:request.path|urlencode}}"> Sign Up </a></li> + {% endif %} {% endif %} </ul> diff --git a/hyperkitty/templates/login.html b/hyperkitty/templates/login.html index 17d8d4b..e81c8b3 100644 --- a/hyperkitty/templates/login.html +++ b/hyperkitty/templates/login.html @@ -27,6 +27,7 @@ </ul> +{% if use_internal_auth %} <h2>Login with username and password</h2> <form action="{{ request.path }}?next={{ next|urlencode }}" method="post" class="form-horizontal"> @@ -38,6 +39,7 @@ </div> </div> </form> +{% endif %} </div> diff --git a/hyperkitty/views/accounts.py b/hyperkitty/views/accounts.py index 640871f..d35641b 100644 --- a/hyperkitty/views/accounts.py +++ b/hyperkitty/views/accounts.py @@ -23,6 +23,7 @@ import logging from django.conf import settings from django.core.urlresolvers import reverse +from django.core.exceptions import SuspiciousOperation from django.contrib.auth import logout, authenticate, login from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User @@ -90,6 +91,8 @@ def user_profile(request, user_email=None): def user_registration(request): + if not settings.USE_INTERNAL_AUTH: + raise SuspiciousOperation redirect_to = request.REQUEST.get("next", reverse("root")) if not is_safe_url(url=redirect_to, host=request.get_host()): redirect_to = settings.LOGIN_REDIRECT_URL |