Commits

Michael Elsdörfer committed 9e6b2bb Merge

Merge upstream.

  • Participants
  • Parent commits 63ba6b9, 3a6dcff

Comments (0)

Files changed (1)

djutils/auth/views.py

 def login(request, template_name='registration/login.html',
           success_url=settings.LOGIN_REDIRECT_URL, on_success=None,
           redirect_field_name=REDIRECT_FIELD_NAME,
-          redirect_to_referrer=False,
+          redirect_to_referrer=False, form_class=LoginForm,
           messages = {}, render_response=render_to_response):
     """
     Similar to Django's builtin ``login`` view, but with additional
 
     # Handle submitted login data
     if request.method == "POST":
-        login_form = LoginForm(request, request.POST, messages=messages)
+        login_form = form_class(request, request.POST, messages=messages)
         if login_form.login():
             result = on_success and on_success() or None
             final_redirect = (
         # as an initial value in the form, or a referrer redirect may be
         # lost, and a GET field redirect may also be lost, albeit more
         # rarely, if the form POST url includes it's own query string.
-        login_form = LoginForm(request, messages=messages,
+        login_form = form_class(request, messages=messages,
                                initial={'redirect': redirect_to})
 
     # Render the view
         }, context_instance=RequestContext(request))
     else:
         # Redirect to this page until the session has been cleared.
-        return HttpResponseRedirect(final_redirect or request.path)
+        return HttpResponseRedirect(final_redirect or request.path)