firefox-email-mailcow-tempe.../Files/popup.js
2025-02-20 00:19:45 +01:00

33 lines
1.2 KiB
JavaScript

document.addEventListener("DOMContentLoaded", function () {
console.log("Popup loaded!"); // Debugging
document.getElementById("login-btn").addEventListener("click", async () => {
console.log("Login button clicked!"); // Debugging
const username = document.getElementById("email").value;
const password = document.getElementById("password").value;
if (!username || !password) {
console.log("Missing username or password");
document.getElementById("status").innerText = "Please enter both email and password.";
return;
}
console.log("Attempting login..."); // Debugging
try {
const success = await login(username, password);
if (success) {
document.getElementById("status").innerText = "Login Successful!";
console.log("Login successful!");
} else {
document.getElementById("status").innerText = "Login Failed!";
console.log("Login failed!");
}
} catch (error) {
console.error("Login error:", error);
document.getElementById("status").innerText = "An error occurred.";
}
});
});