Commits

Diego Búrigo Zacarão committed 7e4c9f4

bugfix: Fixed loop after logout trying to sign in again

- The Sign in link was pointing 'next' to the logout path.
Now it checks if there is a next GET var, before trying to
point to the previous page path

  • Participants
  • Parent commits aaf20d1

Comments (0)

Files changed (2)

File transifex/templates/base-sample.html

               {% blocktrans with user.username as user_username %}Welcome <a title="Profile settings" href="{{ user_profile }}">{{ user_username }}</a>!{% endblocktrans %} |
               <form action="{% url logout %}?next={{request.path}}" method="POST" class="microform"><input type="submit" title="{% trans "Sign out from the website" %}" class="i16 logout buttonize" value="{% trans "Sign out" %}" /></form>
           {% else %}
-              <a href="{% url login %}?next={{request.path}}">{% trans "Sign in" %}</a>
+              <a href="{% url login %}?next={{request|get_next}}">{% trans "Sign in" %}</a>
               {% url signup as signup_url %}
               {% if signup_url %}
               | <a href="{{ signup_url }}">{% trans "Register" %}</a>

File transifex/txcommon/templatetags/txcommontags.py

 def in_list(value, arg):
     """Check if a value is present in a list."""
     return value in arg
+
+@register.filter
+def get_next(request):
+    """Return the next path from the request."""
+    next = request.GET.get('next')
+    if not next:
+        next = request.path
+    return next