ixed files and buttons
This commit is contained in:
47
Profice WebSite/scripts/login-test.js
Normal file
47
Profice WebSite/scripts/login-test.js
Normal file
@@ -0,0 +1,47 @@
|
||||
// Simple test script for login button
|
||||
console.log('Login test script loaded');
|
||||
|
||||
// Clear any existing session that might cause redirect issues
|
||||
localStorage.removeItem('userSession');
|
||||
sessionStorage.removeItem('userSession');
|
||||
console.log('Cleared any existing session data');
|
||||
|
||||
// Wait for DOM
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
console.log('DOM loaded in test script');
|
||||
|
||||
// Find login button
|
||||
const loginBtn = document.getElementById('loginBtn');
|
||||
console.log('Login button found:', !!loginBtn);
|
||||
|
||||
if (loginBtn) {
|
||||
console.log('Login button element:', loginBtn);
|
||||
|
||||
// Determine correct path based on current location
|
||||
const currentPath = window.location.pathname;
|
||||
console.log('Current path:', currentPath);
|
||||
|
||||
let loginPath;
|
||||
if (currentPath.includes('/sites/')) {
|
||||
// Already in sites folder, use relative path
|
||||
loginPath = 'login.html';
|
||||
} else {
|
||||
// In root folder, use sites/ prefix
|
||||
loginPath = 'sites/login.html';
|
||||
}
|
||||
|
||||
console.log('Login path will be:', loginPath);
|
||||
|
||||
// Direct onclick
|
||||
loginBtn.onclick = function(e) {
|
||||
e.preventDefault();
|
||||
console.log('ONCLICK: Login button clicked!');
|
||||
console.log('Navigating to:', loginPath);
|
||||
window.location.href = loginPath;
|
||||
};
|
||||
|
||||
console.log('Click handler attached');
|
||||
} else {
|
||||
console.error('Login button NOT FOUND');
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user