1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-24 04:48:03 +00:00

[adfs] Fix sudo mode

This commit is contained in:
zhengxie
2017-10-12 10:38:35 +08:00
parent 46c4b490b6
commit a9a6069979
2 changed files with 8 additions and 6 deletions

View File

@@ -16,8 +16,8 @@
{% endif %}
<input type="submit" value="{% trans "Confirm Password" %}" class="submit" />
{% if enable_shib_login %}
<button id="shib-login" class="submit fright">{% trans "Shibboleth" %}</button>
{% if enable_sso %}
<button id="shib-login" class="submit fright">SSO</button>
{% endif %}
<div class="sudo-mode-tip">
@@ -43,7 +43,7 @@ $(function() {
});
});
{% if enable_shib_login %}
{% if enable_sso %}
$(function() {
$('#shib-login').click(function() {
window.location = "{% url 'shib_login' %}{% if next %}?next={{ next|escape }}{% endif %}";

View File

@@ -2052,6 +2052,7 @@ def sys_sudo_mode(request):
if not request.user.is_staff:
raise Http404
next = request.GET.get('next', reverse('sys_useradmin'))
password_error = False
if request.method == 'POST':
password = request.POST.get('password')
@@ -2059,15 +2060,16 @@ def sys_sudo_mode(request):
user = authenticate(username=request.user.username, password=password)
if user:
update_sudo_mode_ts(request)
return HttpResponseRedirect(
request.GET.get('next', reverse('sys_useradmin')))
return HttpResponseRedirect(next)
password_error = True
enable_shib_login = getattr(settings, 'ENABLE_SHIB_LOGIN', False)
enable_adfs_login = getattr(settings, 'ENABLE_ADFS_LOGIN', False)
return render_to_response(
'sysadmin/sudo_mode.html', {
'password_error': password_error,
'enable_shib_login': enable_shib_login,
'enable_sso': enable_shib_login or enable_adfs_login,
'next': next,
},
context_instance=RequestContext(request))