Commit ca1db81c authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

Merge branch 'master' of https://code.grnet.gr/git/astakos

parents 1d394e87 6498cee0
......@@ -120,11 +120,19 @@ def get_menu(request):
if request.method != 'GET':
raise BadRequest('Method not allowed.')
location = request.GET.get('location', '')
exclude = []
index_url = reverse('index')
login_url = reverse('login')
logout_url = reverse('astakos.im.views.logout')
absolute = lambda (url): request.build_absolute_uri(url)
index_url = absolute(reverse('astakos.im.views.index'))
if urlparse(location).query.rfind('next=') == -1:
l = index_url, login_url, logout_url
forbidden = []
for url in l:
url = url.rstrip('/')
forbidden.extend([url, url + '/', absolute(url), absolute(url + '/')])
if location not in forbidden:
index_url = '%s?next=%s' % (index_url, quote(location))
l = [{ 'url': index_url, 'name': "Sign in"}]
l = [{ 'url': absolute(index_url), 'name': "Sign in"}]
if request.user.is_authenticated():
l = []
l.append({ 'url': absolute(reverse('astakos.im.views.edit_profile')),
......
......@@ -37,8 +37,8 @@ from astakos.im.forms import ExtendedPasswordResetForm, LoginForm
from astakos.im.settings import IM_MODULES, INVITATIONS_ENABLED
urlpatterns = patterns('astakos.im.views',
url(r'^$', 'index'),
url(r'^login/?$', 'index'),
url(r'^$', 'index', {}, name='index'),
url(r'^login/?$', 'index', {}, name='login'),
url(r'^profile/?$', 'edit_profile'),
url(r'^feedback/?$', 'send_feedback'),
url(r'^signup/?$', 'signup', {'on_success':'im/login.html', 'extra_context':{'form':LoginForm()}}),
......
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