lemonldap-ng/lemonldap-ng-portal/site/coffee/kerberos.coffee

22 lines
702 B
CoffeeScript
Raw Normal View History

2017-04-06 22:37:36 +02:00
# Launch Kerberos request
$(document).ready ->
$.ajax (if window.location.href.match /\/upgradesession/ then window.location.href else portal )+ '?kerberos=1',
2017-04-06 22:37:36 +02:00
dataType: 'json'
2017-10-10 17:23:41 +02:00
# Called if browser can't find Kerberos ticket, will display
2017-04-06 22:37:36 +02:00
# PE_BADCREDENTIALS
statusCode:
401: () ->
2017-04-06 22:37:38 +02:00
$('#lform').submit()
2017-10-10 17:23:41 +02:00
# If request succeed cookie is set, posting form to get redirection
2017-04-06 22:37:36 +02:00
# or menu
success: (data) ->
if window.location.href.match /\/upgradesession/
document.location = portal
else
$('#lform').submit()
2017-04-06 22:37:36 +02:00
# Case else, will display PE_BADCREDENTIALS or fallback to next auth
# backend
error: () ->
2017-04-06 22:37:38 +02:00
$('#lform').submit()