mirror of
https://github.com/9technologygroup/patchmon.net.git
synced 2025-11-14 10:55:43 +00:00
Added security restrictions to admin count endpoint and force admin setup for testing
This commit is contained in:
@@ -17,6 +17,10 @@ export const AuthProvider = ({ children }) => {
|
||||
const [isLoading, setIsLoading] = useState(true)
|
||||
const [permissionsLoading, setPermissionsLoading] = useState(false)
|
||||
const [needsFirstTimeSetup, setNeedsFirstTimeSetup] = useState(false)
|
||||
|
||||
// TEMPORARY DEBUG: Force admin setup for testing
|
||||
// Remove this line after debugging
|
||||
setNeedsFirstTimeSetup(true)
|
||||
const [checkingSetup, setCheckingSetup] = useState(true)
|
||||
|
||||
// Initialize auth state from localStorage
|
||||
@@ -231,8 +235,10 @@ export const AuthProvider = ({ children }) => {
|
||||
|
||||
if (response.ok) {
|
||||
const data = await response.json()
|
||||
console.log('Admin check response:', data) // Debug log
|
||||
setNeedsFirstTimeSetup(!data.hasAdminUsers)
|
||||
} else {
|
||||
console.log('Admin check failed:', response.status, response.statusText) // Debug log
|
||||
// If endpoint doesn't exist or fails, assume setup is needed
|
||||
setNeedsFirstTimeSetup(true)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user