diff --git a/beat/web/ui/templates/ui/bar.html b/beat/web/ui/templates/ui/bar.html index d274e66c1788f0b5deec88e94c89f0cda396cc37..b011c0541c7c8b59d0ef6934fbbfd1a025c5bc0d 100644 --- a/beat/web/ui/templates/ui/bar.html +++ b/beat/web/ui/templates/ui/bar.html @@ -1,21 +1,21 @@ {% comment %} * Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/ * Contact: beat.support@idiap.ch - * + * * This file is part of the beat.web module of the BEAT platform. - * + * * Commercial License Usage * Licensees holding valid commercial BEAT licenses may use this file in * accordance with the terms contained in a written agreement between you * and Idiap. For further information contact tto@idiap.ch - * + * * Alternatively, this file may be used under the terms of the GNU Affero * Public License version 3 as published by the Free Software and appearing * in the file LICENSE.AGPL included in the packaging of this file. * The BEAT platform is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. - * + * * You should have received a copy of the GNU Affero Public License along * with the BEAT platform. If not, see http://www.gnu.org/licenses/. {% endcomment %} @@ -119,7 +119,7 @@ {% else %} <li><p class="navbar-btn"><a class="btn btn-sm btn-primary" title="Register now for free!" href="{% url 'registration' %}"><i class="fa fa-plus fa-fw fa-lg"></i> Sign-up</a></p></li> {% endif %} - <li><p class="navbar-btn"><a class="btn btn-sm btn-success" title="Sign-in" href="{% url 'login' %}"><i class="fa fa-sign-in fa-fw fa-lg"></i> Sign-in</a></p></li> + <li><p class="navbar-btn"><a class="btn btn-sm btn-success" title="Sign-in" href="{% url 'login' %}?next={{ request.path }}"><i class="fa fa-sign-in fa-fw fa-lg"></i> Sign-in</a></p></li> {% else %} <li class="visible-xs"><a title="Your homepage" href="{% url 'activity-stream' request.user.username %}"><i class="fa fa-home fa-fw"></i> Your homepage</a></li> diff --git a/beat/web/ui/views.py b/beat/web/ui/views.py index da6148211da46f100dfda7933b045dbfaec3e86d..fbabd5731a98c0cc4104d1b8649f80665afd9ae3 100644 --- a/beat/web/ui/views.py +++ b/beat/web/ui/views.py @@ -62,7 +62,11 @@ def login(request): response = django_login(request) if request.user.is_authenticated(): - return HttpResponseRedirect(reverse('activity-stream', args=[request.user.username])) + path = request.GET.get('next', '/') + if path in ('/', reverse('login')): + return HttpResponseRedirect(reverse('activity-stream', args=[request.user.username])) + else: + return HttpResponseRedirect(path) return response