fixed centering issue with radius.

Signed-off-by: boris <boris@borishub.co.uk>
This commit is contained in:
boris
2025-04-22 01:17:48 +01:00
parent 183cca3fd3
commit d027e01ccc
12 changed files with 85 additions and 215 deletions

View File

@@ -83,12 +83,12 @@ require('template/header.phtml')
// Validate authentication with server first
let isAdmin = false;
if (simpleAuth.isAuthenticated()) {
if (auth.isAuthenticated()) {
try {
// This will validate the token with the server and handle refresh if needed
const isValid = await simpleAuth.validateOnLoad();
const isValid = await auth.validateOnLoad();
if (isValid) {
isAdmin = simpleAuth.isAdmin();
isAdmin = auth.isAdmin();
}
} catch (error) {
console.error('Error validating authentication:', error);

View File

@@ -96,12 +96,12 @@
createModal.addEventListener('show.bs.modal', async function(event) {
// Validate authentication with server first
let isAdmin = false;
if (simpleAuth.isAuthenticated()) {
if (auth.isAuthenticated()) {
try {
// This will validate the token with the server and handle refresh if needed
const isValid = await simpleAuth.validateOnLoad();
const isValid = await auth.validateOnLoad();
if (isValid) {
isAdmin = simpleAuth.isAdmin();
isAdmin = auth.isAdmin();
}
} catch (error) {
console.error('Error validating authentication:', error);

View File

@@ -15,7 +15,7 @@
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Application JavaScript -->
<!-- Note: simpleAuth.js is already included in the header -->
<!-- Note: auth.js is already included in the header -->
<!-- Note: facilityData.js is already included in the header -->
<script src="/public/js/comments.js"></script>
@@ -55,12 +55,12 @@
// initialise CommentsManager
CommentsManager.state.isDomReady = true;
if (window.simpleAuth) {
if (window.auth) {
CommentsManager.state.isAuthReady = true;
CommentsManager.checkinitialise();
} else {
window.addEventListener('simpleAuthReady', () => {
console.log('SimpleAuth is now ready');
window.addEventListener('authReady', () => {
console.log('auth is now ready');
CommentsManager.state.isAuthReady = true;
CommentsManager.checkinitialise();
});
@@ -73,7 +73,7 @@
if (loginForm) {
// Show CAPTCHA if needed
if (simpleAuth.needsCaptcha() && captchaContainer) {
if (auth.needsCaptcha() && captchaContainer) {
captchaContainer.style.display = 'flex';
}
@@ -106,7 +106,7 @@
try {
// Attempt login
const result = await simpleAuth.login({
const result = await auth.login({
username: username,
password: password,
captchaInput: captchaInput
@@ -147,7 +147,7 @@
}
// Show CAPTCHA if needed
if (simpleAuth.needsCaptcha() && captchaContainer) {
if (auth.needsCaptcha() && captchaContainer) {
captchaContainer.style.display = 'flex';
// Generate new CAPTCHA if needed
if (result.captcha) {
@@ -178,13 +178,13 @@
if (logoutButton) {
logoutButton.addEventListener('click', async (e) => {
e.preventDefault();
await simpleAuth.logout();
await auth.logout();
});
}
// Validate token if authenticated
if (simpleAuth.isAuthenticated()) {
simpleAuth.validateToken().then(valid => {
if (auth.isAuthenticated()) {
auth.validateToken().then(valid => {
if (!valid) {
if (!localStorage.getItem('validationAttempted')) {
localStorage.setItem('validationAttempted', 'true');

View File

@@ -25,7 +25,7 @@
<title>Ecobuddy - <?php echo $view->pageTitle; ?></title>
<!-- Load simplified authentication helper -->
<script src="/public/js/simpleAuth.js"></script>
<script src="/public/js/auth.js"></script>
<!-- Load API client -->
<script src="/public/js/apiClient.js"></script>
@@ -66,11 +66,11 @@
// Add client-side authentication check to update UI
document.addEventListener('DOMContentLoaded', function() {
// Check if user is authenticated on the client side
if (simpleAuth && simpleAuth.isAuthenticated()) {
if (auth && auth.isAuthenticated()) {
console.log('User is authenticated on client side');
// Get user data
const user = simpleAuth.getUser();
const user = auth.getUser();
if (user) {
console.log('User data:', user);
@@ -115,7 +115,7 @@
const logoutButton = document.getElementById('logoutButton');
if (logoutButton) {
logoutButton.addEventListener('click', async function() {
await simpleAuth.logout();
await auth.logout();
window.location.reload();
});
}
@@ -187,10 +187,10 @@
// Validate token with server first
let isAuthenticated = false;
if (simpleAuth.isAuthenticated()) {
if (auth.isAuthenticated()) {
try {
// This will validate the token with the server and handle refresh if needed
isAuthenticated = await simpleAuth.validateOnLoad();
isAuthenticated = await auth.validateOnLoad();
} catch (error) {
console.error('Error validating authentication:', error);
isAuthenticated = false;
@@ -207,8 +207,8 @@
if (isAuthenticated) {
// User is logged in - show user menu
const user = simpleAuth.getUser();
const isAdmin = simpleAuth.isAdmin();
const user = auth.getUser();
const isAdmin = auth.isAdmin();
authSection.innerHTML = `
<div class="user-menu">
@@ -233,7 +233,7 @@
const logoutButton = authSection.querySelector('button[name="logoutButton"]');
if (logoutButton) {
logoutButton.addEventListener('click', async () => {
await simpleAuth.logout();
await auth.logout();
window.location.reload();
});
}
@@ -250,7 +250,7 @@
// Update auth UI when the page loads
document.addEventListener('DOMContentLoaded', updateAuthUI);
// Also update when simpleAuth state changes
// Also update when auth state changes
window.addEventListener('storage', function(e) {
if (e.key === 'token' || e.key === 'user') {
updateAuthUI();
@@ -341,7 +341,7 @@
// Function to update CAPTCHA display
async function updateCaptcha() {
try {
const captcha = await simpleAuth.generateCaptcha();
const captcha = await auth.generateCaptcha();
if (captchaDisplay) {
captchaDisplay.textContent = captcha;
}
@@ -363,7 +363,7 @@
}
// Show/hide CAPTCHA based on login attempts
if (simpleAuth.needsCaptcha() && captchaContainer) {
if (auth.needsCaptcha() && captchaContainer) {
captchaContainer.style.display = 'block';
updateCaptcha();
}
@@ -389,7 +389,7 @@
try {
// Attempt login
const result = await simpleAuth.login({
const result = await auth.login({
username,
password,
captchaInput
@@ -448,7 +448,7 @@
}
// Hide modal if user is already authenticated
if (simpleAuth.isAuthenticated() && loginModal) {
if (auth.isAuthenticated() && loginModal) {
const modalInstance = bootstrap.Modal.getInstance(loginModal);
if (modalInstance) {
modalInstance.hide();

View File

@@ -79,7 +79,7 @@
// Function to update CAPTCHA display
async function updateCaptcha() {
try {
const captcha = await simpleAuth.generateCaptcha();
const captcha = await auth.generateCaptcha();
captchaDisplay.textContent = captcha;
document.getElementById('captchaCode').value = captcha;
} catch (error) {
@@ -93,7 +93,7 @@
}
// Show/hide CAPTCHA based on login attempts
if (simpleAuth.needsCaptcha()) {
if (auth.needsCaptcha()) {
captchaContainer.style.display = 'block';
updateCaptcha();
}
@@ -107,7 +107,7 @@
const password = document.getElementById('password').value;
const captchaInput = document.getElementById('captchaInput')?.value;
const result = await simpleAuth.login({
const result = await auth.login({
username,
password,
captchaInput