summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2011-11-30 12:51:18 -0300
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2011-11-30 12:51:18 -0300
commit75c56f4014164ad1ee92892a67068139422b5597 (patch)
treed737f930bea4b43fb26fecf82aaef498d38f5a16
parent7bea4fa8cec1cbdbfcd5ff20580a879cf69b2787 (diff)
downloadaskbot-75c56f4014164ad1ee92892a67068139422b5597.tar.gz
askbot-75c56f4014164ad1ee92892a67068139422b5597.tar.bz2
askbot-75c56f4014164ad1ee92892a67068139422b5597.zip
made login action redirect to the previous page, unless it was a logout page
-rw-r--r--askbot/skins/default/templates/widgets/user_navigation.html2
-rw-r--r--askbot/templatetags/extra_filters_jinja.py8
2 files changed, 9 insertions, 1 deletions
diff --git a/askbot/skins/default/templates/widgets/user_navigation.html b/askbot/skins/default/templates/widgets/user_navigation.html
index 2324291d..ae892c39 100644
--- a/askbot/skins/default/templates/widgets/user_navigation.html
+++ b/askbot/skins/default/templates/widgets/user_navigation.html
@@ -7,7 +7,7 @@
</span>
<a href="{{ settings.LOGOUT_URL }}?next={{ settings.LOGOUT_REDIRECT_URL }}">{% trans %}logout{% endtrans %}</a>
{% else %}
- <a href="{{ settings.LOGIN_URL }}">{% trans %}login{% endtrans %}</a>
+ <a href="{{ settings.LOGIN_URL }}?next={{request.path|clean_login_url}}">{% trans %}login{% endtrans %}</a>
{% endif %}
{% if request.user.is_authenticated() and request.user.is_administrator() %}
diff --git a/askbot/templatetags/extra_filters_jinja.py b/askbot/templatetags/extra_filters_jinja.py
index b74502df..5be86dc2 100644
--- a/askbot/templatetags/extra_filters_jinja.py
+++ b/askbot/templatetags/extra_filters_jinja.py
@@ -6,6 +6,7 @@ from django.core import exceptions as django_exceptions
from django.utils.translation import ugettext as _
from django.contrib.humanize.templatetags import humanize
from django.template import defaultfilters
+from django.core.urlresolvers import reverse
from askbot import exceptions as askbot_exceptions
from askbot import auth
from askbot.conf import settings as askbot_settings
@@ -31,6 +32,13 @@ def absolutize_urls_func(text):
absolutize_urls = register.filter(absolutize_urls_func)
@register.filter
+def clean_login_url(url):
+ """pass through, unless user was originally on the logout page"""
+ if url == reverse('logout'):
+ return reverse('index')
+ return url
+
+@register.filter
def country_display_name(country_code):
country_dict = dict(countries.COUNTRIES)
return country_dict[country_code]