1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-01 07:10:55 +00:00

Add shibboleth login option

This commit is contained in:
zhengxie 2015-03-05 14:48:07 +08:00
parent b6f8935c0f
commit f9c9f8be01
4 changed files with 28 additions and 7 deletions

View File

@ -191,14 +191,17 @@ def login(request, template_name='registration/login.html',
else:
signup_url = ''
enable_shib_login = getattr(settings, 'ENABLE_SHIB_LOGIN', False)
return render_to_response(template_name, {
'form': form,
redirect_field_name: redirect_to,
'site': current_site,
'site_name': current_site.name,
'remember_days': settings.LOGIN_REMEMBER_DAYS,
'signup_url': signup_url,
}, context_instance=RequestContext(request))
'form': form,
redirect_field_name: redirect_to,
'site': current_site,
'site_name': current_site.name,
'remember_days': settings.LOGIN_REMEMBER_DAYS,
'signup_url': signup_url,
'enable_shib_login': enable_shib_login,
}, context_instance=RequestContext(request))
def login_simple_check(request):
"""A simple check for login called by thirdpart systems(OA, etc).

View File

@ -61,6 +61,10 @@
{% if enable_signup %}
<a href="{{ signup_url }}">{% trans "Signup" %}</a>
{% endif %}
{% if enable_shib_login %}
<button id="shib-login" class="submit fright">{% trans "Shibboleth" %}</button>
{% endif %}
</form>
</div>
{% endblock %}
@ -126,5 +130,11 @@ $(function() {
});
})();
$(function() {
$('#shib-login').click(function() {
window.location = "{% url 'shib_login' %}";
return false;
});
});
</script>
{% endblock %}

View File

@ -264,6 +264,11 @@ if getattr(settings, 'MULTI_TENANCY', False):
(r'^org/', include('seahub_extra.organizations.urls')),
)
if getattr(settings, 'ENABLE_SHIB_LOGIN', False):
urlpatterns += patterns('',
url(r'^shib-login/', shib_login, name="shib_login"),
)
# serve office converter static files
from seahub.utils import HAS_OFFICE_CONVERTER, CLUSTER_MODE, OFFICE_CONVERTOR_NODE
if HAS_OFFICE_CONVERTER:

View File

@ -1938,3 +1938,6 @@ def image_view(request, filename):
if content_encoding:
response['Content-Encoding'] = content_encoding
return response
def shib_login(request):
return HttpResponseRedirect(reverse('myhome'))