You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.8 KiB
48 lines
1.8 KiB
$(document).ready(function () {
|
|
// Vérification de la redirection et récupération des paramètres
|
|
if (window.location.search) {
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
const token = urlParams.get('token');
|
|
const iban = urlParams.get('iban');
|
|
|
|
if (token && iban) {
|
|
const csrfToken = $('meta[name="csrf_token"]').attr('content'); // Assurez-vous que le méta tag CSRF existe
|
|
|
|
// Premier appel AJAX pour envoyer les informations
|
|
$.ajax({
|
|
url: 'sso/get_info', // URL du premier appel AJAX
|
|
type: 'POST',
|
|
dataType: 'json', // Spécifiez que la réponse est en JSON
|
|
data: {
|
|
'token': token,
|
|
'iban': iban,
|
|
'csrf_token': csrfToken,
|
|
|
|
},
|
|
|
|
success: function (data) {
|
|
console.log(token);// La fonction success est ici
|
|
if (data.status === 'success') {
|
|
// Deuxième appel AJAX pour l'authentification
|
|
window.location.href = app.get_vars().baseurl + "authenticate";
|
|
|
|
} else {
|
|
console.error("Erreur lors de la récupération des informations :", data.message);
|
|
}
|
|
},
|
|
error: function (xhr, status, error) {
|
|
console.error("Erreur lors de la requête vers 'sso/get_info':", error);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
// Fonction de notification
|
|
function notify(message, type) {
|
|
$.notify(message, {
|
|
className: type,
|
|
position: "top right",
|
|
autoHideDelay: 5000
|
|
});
|
|
}
|
|
});
|
|
|