Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#944 closed enhancement (fixed)

allow app to specify a template for login/logout screens

Reported by: Ian@… Owned by: adrian
Component: Core (Other) Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

probably should make LOGIN_URL & REDIRECT_TO settings in the config.

Index: login.py
===================================================================
--- login.py    (revision 1474)
+++ login.py    (working copy)
@@ -8,7 +8,7 @@
 REDIRECT_FIELD_NAME = 'next'
 LOGIN_URL = '/accounts/login/'
 
-def login(request):
+def login(request, template_name='/registration/login'):
     "Displays the login form and handles the login action."
     manipulator = AuthenticationForm(request)
     redirect_to = request.REQUEST.get(REDIRECT_FIELD_NAME, '')
@@ -24,18 +24,18 @@
     else:
         errors = {}
     request.session.set_test_cookie()
-    return render_to_response('registration/login', {
+    return render_to_response(template_name , {
         'form': formfields.FormWrapper(manipulator, request.POST, errors),
         REDIRECT_FIELD_NAME: redirect_to,
         'site_name': sites.get_current().name,
     }, context_instance=DjangoContext(request))
 
-def logout(request, next_page=None):
+def logout(request, next_page=None, template_name ='registration/logged_out'):
     "Logs out the user and displays 'You are logged out' message."
     try:
         del request.session[users.SESSION_KEY]
     except KeyError:
-        return render_to_response('registration/logged_out', context_instance=DjangoContext(request))
+        return render_to_response(template_name, context_instance=DjangoContext(request))
     else:
         # Redirect to this page until the session has been cleared.
         return HttpResponseRedirect(next_page or request.path)

Change History (1)

comment:1 Changed 9 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

This was fixed in [3087].

Note: See TracTickets for help on using tickets.
Back to Top