1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-12 04:12:16 +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,6 +191,8 @@ def login(request, template_name='registration/login.html',
else: else:
signup_url = '' signup_url = ''
enable_shib_login = getattr(settings, 'ENABLE_SHIB_LOGIN', False)
return render_to_response(template_name, { return render_to_response(template_name, {
'form': form, 'form': form,
redirect_field_name: redirect_to, redirect_field_name: redirect_to,
@ -198,6 +200,7 @@ def login(request, template_name='registration/login.html',
'site_name': current_site.name, 'site_name': current_site.name,
'remember_days': settings.LOGIN_REMEMBER_DAYS, 'remember_days': settings.LOGIN_REMEMBER_DAYS,
'signup_url': signup_url, 'signup_url': signup_url,
'enable_shib_login': enable_shib_login,
}, context_instance=RequestContext(request)) }, context_instance=RequestContext(request))
def login_simple_check(request): def login_simple_check(request):

View File

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

View File

@ -264,6 +264,11 @@ if getattr(settings, 'MULTI_TENANCY', False):
(r'^org/', include('seahub_extra.organizations.urls')), (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 # serve office converter static files
from seahub.utils import HAS_OFFICE_CONVERTER, CLUSTER_MODE, OFFICE_CONVERTOR_NODE from seahub.utils import HAS_OFFICE_CONVERTER, CLUSTER_MODE, OFFICE_CONVERTOR_NODE
if HAS_OFFICE_CONVERTER: if HAS_OFFICE_CONVERTER:

View File

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