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:
@@ -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=""):
|
||||
|
||||
Reference in New Issue
Block a user