107 |
107 |
if request.method != 'GET':
|
108 |
108 |
raise BadRequest('Method not allowed.')
|
109 |
109 |
location = request.GET.get('location', '')
|
110 |
|
index_url = reverse('astakos.im.views.index')
|
|
110 |
absolute = lambda (url): request.build_absolute_uri(url)
|
|
111 |
index_url = absolute(reverse('astakos.im.views.index'))
|
111 |
112 |
if urlparse(location).query.rfind('next=') == -1:
|
112 |
113 |
index_url = '%s?next=%s' % (index_url, quote(location))
|
113 |
114 |
l = [{ 'url': index_url, 'name': "login..."}]
|
114 |
115 |
if request.user.is_authenticated():
|
115 |
116 |
l = []
|
116 |
|
l.append({ 'url': reverse('astakos.im.views.edit_profile'), 'name': request.user.email})
|
117 |
|
l.append({ 'url': reverse('astakos.im.views.edit_profile'), 'name': "view your profile..." })
|
|
117 |
l.append({ 'url': absolute(reverse('astakos.im.views.edit_profile')),
|
|
118 |
'name': request.user.email})
|
|
119 |
l.append({ 'url': absolute(reverse('astakos.im.views.edit_profile')),
|
|
120 |
'name': "view your profile..." })
|
118 |
121 |
if request.user.password:
|
119 |
|
l.append({ 'url': reverse('password_change'), 'name': "change your password..." })
|
|
122 |
l.append({ 'url': absolute(reverse('password_change')),
|
|
123 |
'name': "change your password..." })
|
120 |
124 |
if INVITATIONS_ENABLED:
|
121 |
|
l.append({ 'url': reverse('astakos.im.views.invite'), 'name': "invite some friends..." })
|
122 |
|
l.append({ 'url': reverse('astakos.im.views.send_feedback'), 'name': "feedback..." })
|
123 |
|
l.append({ 'url': reverse('astakos.im.views.logout'), 'name': "logout..."})
|
|
125 |
l.append({ 'url': absolute(reverse('astakos.im.views.invite')),
|
|
126 |
'name': "invite some friends..." })
|
|
127 |
l.append({ 'url': absolute(reverse('astakos.im.views.send_feedback')),
|
|
128 |
'name': "feedback..." })
|
|
129 |
l.append({ 'url': absolute(reverse('astakos.im.views.logout')),
|
|
130 |
'name': "logout..."})
|
124 |
131 |
data = json.dumps(tuple(l))
|
125 |
132 |
return HttpResponse(content=data, mimetype="application/json")
|