17 lines
467 B
JavaScript
17 lines
467 B
JavaScript
async function login(username, password) {
|
|
const authHeader = "Basic " + btoa(username + ":" + password);
|
|
|
|
const response = await fetch("https://mail.pandem.fr/SOGo/so/session", {
|
|
method: "POST",
|
|
headers: {
|
|
"Authorization": authHeader,
|
|
"Content-Type": "application/json"
|
|
}
|
|
});
|
|
|
|
if (response.ok) {
|
|
return true; // Successfully logged in
|
|
} else {
|
|
return false; // Login failed
|
|
}
|
|
}
|