Fix django auth login redirection

The django authentication decorator login_required, redirects to
settings.LOGIN_URL. If it is missing, it redirects to /accounts/login.

We did not have the setting enable, not a proper page where to
redirect. This cause users not logged in to see a 404 error when
accessing courseware directly, by using a link or a bookmark.

[#41499213]
This commit is contained in:
Carlos Andrés Rocha
2012-12-19 18:48:30 -05:00
parent 89527281e8
commit 5d85fab283
4 changed files with 109 additions and 0 deletions

View File

@@ -333,6 +333,18 @@ def change_enrollment(request):
return {'success': False, 'error': 'We weren\'t able to unenroll you. Please try again.'}
@ensure_csrf_cookie
def accounts_login(request, error=""):
return_to = ''
return render_to_response('accounts_login.html', {
'error': error,
'return_to': return_to
})
# Need different levels of logging
@ensure_csrf_cookie
def login_user(request, error=""):