Commit 5a2f157f by XuYS

更新登录页跳转

parent f5030721
...@@ -39,29 +39,32 @@ def login_page(request): ...@@ -39,29 +39,32 @@ def login_page(request):
""" """
Display the login form. Display the login form.
""" """
csrf_token = csrf(request)['csrf_token'] if request.user.is_authenticated():
if (settings.FEATURES['AUTH_USE_CERTIFICATES'] and return redirect('/home/')
ssl_get_cert_from_request(request)): else:
# SSL login doesn't require a login view, so redirect csrf_token = csrf(request)['csrf_token']
# to course now that the user is authenticated via if (settings.FEATURES['AUTH_USE_CERTIFICATES'] and
# the decorator. ssl_get_cert_from_request(request)):
next_url = request.GET.get('next') # SSL login doesn't require a login view, so redirect
if next_url: # to course now that the user is authenticated via
return redirect(next_url) # the decorator.
else: next_url = request.GET.get('next')
return redirect('/course/') if next_url:
if settings.FEATURES.get('AUTH_USE_CAS'): return redirect(next_url)
# If CAS is enabled, redirect auth handling to there else:
return redirect(reverse('cas-login')) return redirect('/course/')
if settings.FEATURES.get('AUTH_USE_CAS'):
# If CAS is enabled, redirect auth handling to there
return redirect(reverse('cas-login'))
return render_to_response( return render_to_response(
'login.html', 'login.html',
{ {
'csrf': csrf_token, 'csrf': csrf_token,
'forgot_password_link': "//{base}/login#forgot-password-modal".format(base=settings.LMS_BASE), 'forgot_password_link': "//{base}/login#forgot-password-modal".format(base=settings.LMS_BASE),
'platform_name': configuration_helpers.get_value('platform_name', settings.PLATFORM_NAME), 'platform_name': configuration_helpers.get_value('platform_name', settings.PLATFORM_NAME),
} }
) )
def howitworks(request): def howitworks(request):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment