From a62f8d263ecfaa033e1d9ad7d9caf7a174045e00 Mon Sep 17 00:00:00 2001 From: Antoine Nguyen Date: Wed, 12 Jun 2013 11:42:02 +0200 Subject: [PATCH] Changing how default redirection works. --- modoboa/auth/views.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modoboa/auth/views.py b/modoboa/auth/views.py index 78f3e7284..c9b098044 100755 --- a/modoboa/auth/views.py +++ b/modoboa/auth/views.py @@ -34,9 +34,12 @@ def dologin(request): form.cleaned_data["username"], form.cleaned_data["password"]) - nextlocation = request.POST["next"] - if nextlocation.strip() in ["", "None"]: - nextlocation = reverse("domains") + nextlocation = request.POST.get("next", None) + if nextlocation is None or nextlocation == "None": + if user.group != "SimpleUsers": + nextlocation = reverse("modoboa.lib.webutils.topredirection") + else: + nextlocation = reverse("domains") return HttpResponseRedirect(nextlocation) error = _("Your username and password didn't match. Please try again.") logger.warning("Failed connection attempt from '%(addr)s' as user '%(user)s'" \