Commit 8120617a authored by Zenon Mousmoulas's avatar Zenon Mousmoulas

Ensure that "next" parameter in query string persists through login-related

redirects
parent 5aa2cdf0
......@@ -10,15 +10,17 @@
<div class="well">
<div class="row-fluid">
<div class="span12">
<a class="btn btnlogin" href="{% url manage_login 'shibboleth' %}">
{% with qs=request.GET.urlencode %}
<a class="btn btnlogin" href="{% url manage_login 'shibboleth' %}{% if qs %}?{{qs}}{% endif %}">
<img src="{% static 'img/image_shibboleth_logo_color.png' %}" style="padding: 0px;">
<br>Shibboleth</a>
<a class="btn btnlogin" href="{% url manage_login 'twitter' %}">
<a class="btn btnlogin" href="{% url manage_login 'twitter' %}{% if qs %}?{{qs}}{% endif %}">
<i class="fa fa-twitter fa-2x"></i>
<br>Twitter</a>
<a class="btn btnlogin" href="{% url manage_login 'google-oauth2' %}">
<a class="btn btnlogin" href="{% url manage_login 'google-oauth2' %}{% if qs %}?{{qs}}{% endif %}">
<i class="fa fa-google fa-2x"></i>
<br>Google</a>
{% endwith %}
</div>
</div>
</div>
......
......@@ -25,6 +25,7 @@ from django.utils.translation import ugettext as _
from django.contrib.auth import authenticate, login
from django.contrib.auth.models import User
from django.core.cache import cache
from django.contrib.auth import REDIRECT_FIELD_NAME
from edumanage.models import (
ServiceLoc,
......@@ -1540,7 +1541,7 @@ def manage_login(request, backend):
qs = request.GET.urlencode()
qs = '?%s' % qs if qs else ''
if backend == 'shibboleth':
return redirect(reverse('login'))
return redirect(reverse('login') + qs)
return redirect(reverse('social:begin', args=[backend]) + qs)
......@@ -1612,7 +1613,10 @@ def user_login(request):
if user.is_active:
login(request, user)
return HttpResponseRedirect(reverse("manage"))
return HttpResponseRedirect(
request.GET.get(REDIRECT_FIELD_NAME,
default=reverse('manage'))
)
else:
status = _(
"User account <strong>%s</strong> is pending activation."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment