lemonldap-ng/lemonldap-ng-portal/site/htdocs/static/common/js/sslChoice.js

48 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-01-15 22:12:02 +01:00
// Generated by CoffeeScript 1.12.7
2019-02-01 23:22:11 +01:00
(function() {
var sendUrl, tryssl;
2019-02-01 23:22:11 +01:00
tryssl = function() {
var path;
2019-07-09 10:34:46 +02:00
path = window.location.pathname;
console.log('path -> ', path);
console.log('Call URL -> ', window.datas.sslHost);
$.ajax(window.datas.sslHost, {
dataType: 'jsonp',
2019-02-01 23:22:11 +01:00
statusCode: {
401: function() {
$('#lformSSL').submit();
return console.log('Error code 401');
}
},
success: function(data) {
sendUrl(path);
2019-02-01 23:22:11 +01:00
return console.log('Success -> ', data);
},
error: function() {
sendUrl(path);
2019-02-01 23:22:11 +01:00
return console.log('Error');
}
});
return false;
2019-02-01 23:22:11 +01:00
};
sendUrl = function(path) {
var form_url;
form_url = $('#lformSSL').attr('action');
if (form_url.match(/^#$/)) {
form_url = path;
} else {
form_url = form_url + path;
}
console.log('form action URL -> ', form_url);
$('#lformSSL').attr('action', form_url);
return $('#lformSSL').submit();
};
2019-02-01 23:22:11 +01:00
$(document).ready(function() {
return $('.sslclick').on('click', tryssl);
});
}).call(this);