Login and index view work.
Fix the docstrings. Rename the pre_login_test view to just login. Functionality is still the same.
This commit is contained in:
		
							parent
							
								
									63de6467f6
								
							
						
					
					
						commit
						b25eb12d7e
					
				
					 2 changed files with 6 additions and 3 deletions
				
			
		
							
								
								
									
										1
									
								
								urls.py
									
										
									
									
									
								
							
							
						
						
									
										1
									
								
								urls.py
									
										
									
									
									
								
							|  | @ -11,6 +11,7 @@ admin.autodiscover() | |||
| urlpatterns = patterns('', | ||||
|     url(r'^%s(?P<path>.*)$' % 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')), | ||||
| ) | ||||
|  |  | |||
							
								
								
									
										8
									
								
								views.py
									
										
									
									
									
								
							
							
						
						
									
										8
									
								
								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/') | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue