feat: support change-password and admin must_change_password
This commit is contained in:
@@ -35,6 +35,14 @@ export const useAuth = () => {
|
||||
if (res.ok) {
|
||||
console.log('[Auth] User synced successfully')
|
||||
user.value = res.user
|
||||
|
||||
const route = useRoute()
|
||||
if (res.user.must_change_password && route.path !== '/auth/change-password') {
|
||||
console.log('[Auth] User must change password, redirecting...')
|
||||
await navigateTo('/auth/change-password')
|
||||
} else {
|
||||
await navigateTo('/dashboard')
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[Auth] Sync failed, logging out:', error)
|
||||
|
||||
Reference in New Issue
Block a user