Error message when the client doesn't do cookies.
This commit is contained in:
parent
47589abe93
commit
eacaa2db3a
1 changed files with 5 additions and 5 deletions
10
views.py
10
views.py
|
@ -1,14 +1,13 @@
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.shortcuts import redirect, render_to_response
|
from django.shortcuts import redirect, render_to_response
|
||||||
|
from django.template import RequestContext
|
||||||
|
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
'''Index page. Everyone starts here. If the user is logged in (that is, they
|
'''Index page. Everyone starts here. If the user is logged in (that is, they
|
||||||
have a session id) return the follower_graph view. Otherwise, render the
|
have a session id) return the follower_graph view. Otherwise, render the
|
||||||
index page.'''
|
index page.'''
|
||||||
if request.method == 'POST':
|
if request.session.get('sessionid', False):
|
||||||
return redirect('login')
|
|
||||||
if 'sessionid' in request.session:
|
|
||||||
return follower_graph(request)
|
return follower_graph(request)
|
||||||
# Set a test cookie. When the user clicks the 'Login' button, test and make
|
# Set a test cookie. When the user clicks the 'Login' button, test and make
|
||||||
# sure this cookie was set properly.
|
# sure this cookie was set properly.
|
||||||
|
@ -24,8 +23,9 @@ def login(request):
|
||||||
request.session.delete_test_cookie()
|
request.session.delete_test_cookie()
|
||||||
return redirect('/login/github/')
|
return redirect('/login/github/')
|
||||||
else:
|
else:
|
||||||
# TODO: Render an error -- fix your damn cookies!
|
# Render an error -- fix your damn cookies!
|
||||||
return render_to_response('login.html')
|
return render_to_response('login.html',
|
||||||
|
{ 'error': "Fix your damn cookies!" })
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue