2017-04-11 21:19:59 +02:00
|
|
|
# Launch SSL request
|
|
|
|
|
|
|
|
tryssl = () ->
|
2019-07-09 10:34:46 +02:00
|
|
|
host = window.datas.sslHost
|
|
|
|
path = window.location.pathname
|
|
|
|
url = "#{host}#{path}"
|
|
|
|
console.log 'Call URL -> ', url
|
|
|
|
$.ajax url,
|
2019-02-07 19:27:42 +01:00
|
|
|
dataType: 'jsonp'
|
2017-04-11 21:19:59 +02:00
|
|
|
# PE_BADCREDENTIALS
|
|
|
|
statusCode:
|
|
|
|
401: () ->
|
|
|
|
$('#lform').submit()
|
2019-02-01 23:22:11 +01:00
|
|
|
console.log 'Error code 401'
|
2017-04-11 21:19:59 +02:00
|
|
|
# If request succeed, cookie is set, posting form to get redirection
|
|
|
|
# or menu
|
|
|
|
success: (data) ->
|
|
|
|
$('#lform').submit()
|
2019-02-01 23:22:11 +01:00
|
|
|
console.log 'Success -> ', data
|
2017-04-11 21:19:59 +02:00
|
|
|
# Case else, will display PE_BADCREDENTIALS or fallback to next auth
|
|
|
|
# backend
|
|
|
|
error: () ->
|
|
|
|
$('#lform').submit()
|
2019-02-01 23:22:11 +01:00
|
|
|
console.log 'Error'
|
2019-06-27 16:40:56 +02:00
|
|
|
false
|
2019-07-09 10:34:46 +02:00
|
|
|
|
2017-04-11 21:19:59 +02:00
|
|
|
$(document).ready ->
|
|
|
|
$('.sslclick').on 'click', tryssl
|