diff --git a/urls.py b/urls.py index 84b1e12..ee91f6d 100644 --- a/urls.py +++ b/urls.py @@ -11,6 +11,7 @@ admin.autodiscover() urlpatterns = patterns('', url(r'^%s(?P.*)$' % re.escape(settings.STATIC_URL.lstrip('/')), 'django.contrib.staticfiles.views.serve', {'insecure': True}), url(r'^admin/', include(admin.site.urls)), + url(r'^login/', views.login, name='login'), url(r'^$', views.index, name='index'), url(r'', include('social_auth.urls')), ) diff --git a/views.py b/views.py index 62e744f..a55eb69 100644 --- a/views.py +++ b/views.py @@ -4,8 +4,8 @@ from django.shortcuts import redirect, render_to_response def index(request): '''Index page. Everyone starts here. If the user is logged in (that is, they - have a session id) redirect them to the follower graph view. Otherwise, - render the index page.''' + have a session id) return the follower_graph view. Otherwise, render the + index page.''' if request.method == 'POST': request.session.set_test_cookie() return redirect('login') @@ -14,7 +14,9 @@ def index(request): return render_to_response('login.html') -def pre_login_test(request): +def login(request): + '''Do a quick check to make sure cookies are enabled. If so, redirect to + GitHub so the user can login.''' if request.session.test_cookie_worked(): request.session.delete_test_cookie() return redirect('/login/github/')