diff accounts/views.py @ 692:4a49d4ac319f

For #51, remove the ajax popup login window.
author Brian Neal <bgneal@gmail.com>
date Sun, 01 Sep 2013 15:58:45 -0500
parents 81e0be69b3a5
children 004b3a90de66
line wrap: on
line diff
--- a/accounts/views.py	Sun Sep 01 11:59:28 2013 -0500
+++ b/accounts/views.py	Sun Sep 01 15:58:45 2013 -0500
@@ -2,17 +2,12 @@
 Views for the accounts application.
 
 """
-import json
 import logging
 
 from django.shortcuts import render
-from django.template import RequestContext
-from django.template.loader import render_to_string
-from django.http import HttpResponse, HttpResponseRedirect
+from django.http import HttpResponseRedirect
 from django.core.urlresolvers import reverse
 from django.conf import settings
-from django.contrib.auth.forms import AuthenticationForm
-from django.contrib.auth import login
 
 from accounts.models import PendingUser
 from accounts.forms import RegisterForm, ForgotUsernameForm
@@ -80,35 +75,6 @@
 
 #######################################################################
 
-@log_auth_failures('Login')
-def login_ajax(request):
-    """
-    This view function handles a login via AJAX.
-
-    """
-    if not request.is_ajax():
-        return HttpResponseRedirect(reverse('accounts-login'))
-
-    response = {
-        'success': False,
-        'error': '',
-        'navbar_html': ''
-    }
-
-    if request.method == "POST":
-        form = AuthenticationForm(data=request.POST)
-        if form.is_valid():
-            login(request, form.get_user())
-            response['success'] = True
-            response['navbar_html'] = render_to_string('navbar.html',
-                    {'user': request.user}, RequestContext(request))
-        else:
-            response['error'] = 'Invalid username or password'
-
-    return HttpResponse(json.dumps(response), content_type='application/json')
-
-#######################################################################
-
 def username_query(request):
     """This view handles forgotten username queries."""
     if request.user.is_authenticated():