Simplify auth system by removing throttling and mobile workarounds
All checks were successful
Build And Push Image / docker (push) Successful in 3m0s
All checks were successful
Build And Push Image / docker (push) Successful in 3m0s
- Remove session check throttling mechanism from useAuth composable - Eliminate forced auth check parameters throughout codebase - Replace window.location redirects with standard navigateTo() - Remove mobile-specific authentication handling and diagnostics - Move auth check to onMounted hook in login page - Clean up console logging for auth operations
This commit is contained in:
@@ -66,9 +66,9 @@ export const useAuth = () => {
|
||||
|
||||
while (!sessionSuccess && attempts < maxAttempts) {
|
||||
attempts++;
|
||||
console.log(`🔄 Forced session check attempt ${attempts}/${maxAttempts}`);
|
||||
console.log(`🔄 Session check attempt ${attempts}/${maxAttempts}`);
|
||||
|
||||
sessionSuccess = await checkAuth(true); // Force bypass throttling for login
|
||||
sessionSuccess = await checkAuth();
|
||||
|
||||
if (!sessionSuccess && attempts < maxAttempts) {
|
||||
console.log('⏳ Session not ready, waiting 500ms...');
|
||||
@@ -150,24 +150,10 @@ export const useAuth = () => {
|
||||
}
|
||||
};
|
||||
|
||||
// Session check throttling to prevent iOS Safari loops
|
||||
const lastSessionCheck = ref(0);
|
||||
const SESSION_CHECK_THROTTLE = 5000; // 5 seconds minimum between checks
|
||||
|
||||
// Check authentication status with smart throttling
|
||||
const checkAuth = async (force = false) => {
|
||||
const now = Date.now();
|
||||
|
||||
// Allow forced checks to bypass throttling for critical operations
|
||||
if (!force && now - lastSessionCheck.value < SESSION_CHECK_THROTTLE) {
|
||||
console.log('🚫 Session check throttled, using cached result');
|
||||
return !!user.value;
|
||||
}
|
||||
|
||||
// Check authentication status - simple and reliable
|
||||
const checkAuth = async () => {
|
||||
try {
|
||||
const logType = force ? 'forced' : 'throttled';
|
||||
console.log(`🔄 Performing ${logType} session check...`);
|
||||
lastSessionCheck.value = now;
|
||||
console.log('🔄 Performing session check...');
|
||||
|
||||
const response = await $fetch<{
|
||||
authenticated: boolean;
|
||||
|
||||
Reference in New Issue
Block a user