Login form var Macos ve ios da form çalışmıyor kod da sorun var sanırım çünkü çalışan bir sayfa var ben de oradan api ile çekiyorum çektiğim kod
function sendLoginForm(e) {
//alert("Hello World");
var http = new XMLHttpRequest();
var url = 'https://site.com/v1/auth/login';
var username = document.getElementById('username').value;
var password = document.getElementById('password').value;
http.open('POST', url, true);
//Send the proper header information along with the request
http.setRequestHeader('Content-type', "application/json;charset=UTF-8");
http.onreadystatechange = function() {//Call a function when the state changes.
if(http.readyState == 4 && http.status == 200) {
var responsebody = JSON.parse(http.responseText);
let elIfrm = document.getElementById('iframe').contentWindow;
elIfrm.postMessage('auth-token:'+responsebody.token, 'https://site.com');
elIfrm.postMessage('auth-role:'+responsebody.role, 'https://site.com');
if (responsebody.role === 'ADVISOR') {
setTimeout(function () {
location.replace("https://site.com/#/admin/customers");
}, 0);
} else {
setTimeout(function () {
location.replace("https://site.com/");
}, 0);
}
}
}
var json = {"email":username, "password":password};
http.send(JSON.stringify(json));
return false;
}Ayrıca iframe den de bu kodu çalıştırıyorum
window.addEventListener("message", event => {
var msj = event.data;
var parts = msj.split(':');
sessionStorage.setItem(parts[0], parts[1]);
document.cookie = "cookieName= true; expires=Fri, 31 Dec 9999 23:59:59 GMT";
const d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
let expires = "expires="+ d.toUTCString();
document.cookie = parts[0] + "=" + parts[1] + ";" + expires + ";path=/";
});yapabilecek arkadaşlar
https://wa.me/905468759153?text= bana WhatsApp Üzerinden ulaşabilir