diff --git a/frontend/src/App.vue b/frontend/src/App.vue
index 3b8127a..db55787 100644
--- a/frontend/src/App.vue
+++ b/frontend/src/App.vue
@@ -5,7 +5,7 @@
-
+
@@ -17,7 +17,7 @@ import LoginView from '@/components/LoginView.vue'
import RegisterView from '@/components/RegisterView.vue'
import ProfileView from '@/components/ProfileView.vue'
import DeviceLinkView from '@/components/DeviceLinkView.vue'
-import AddCredentialView from '@/components/AddCredentialView.vue'
+import ResetView from '@/components/ResetView.vue'
const store = useAuthStore()
@@ -34,15 +34,6 @@ onMounted(async () => {
console.log('Failed to load user info:', error)
store.currentView = 'login'
}
- if (store.currentCredentials.length) {
- // User is logged in, go to profile
- store.currentView = 'profile'
- } else if (store.currentUser) {
- // User is logged in via reset link, allow adding a credential
- store.currentView = 'add-credential'
- } else {
- // User is not logged in, show login
- store.currentView = 'login'
- }
+ store.selectView()
})
diff --git a/frontend/src/components/ProfileView.vue b/frontend/src/components/ProfileView.vue
index 9491346..f150683 100644
--- a/frontend/src/components/ProfileView.vue
+++ b/frontend/src/components/ProfileView.vue
@@ -2,14 +2,14 @@
👋 Welcome!
-
-
👤 {{ authStore.currentUser.user_name }}
+
+
👤 {{ authStore.userInfo.user.user_name }}
Visits:
- {{ authStore.currentUser.visits || 0 }}
+ {{ authStore.userInfo.user.visits || 0 }}
Registered:
- {{ formatDate(authStore.currentUser.created_at) }}
+ {{ formatDate(authStore.userInfo.user.created_at) }}
Last seen:
- {{ formatDate(authStore.currentUser.last_seen) }}
+ {{ formatDate(authStore.userInfo.user.last_seen) }}
Your Passkeys
@@ -17,12 +17,12 @@
-
+
@@ -89,8 +89,9 @@ const updateInterval = ref(null)
onMounted(() => {
updateInterval.value = setInterval(() => {
// Trigger Vue reactivity to update formatDate fields
- authStore.currentUser = { ...authStore.currentUser }
- authStore.currentCredentials = [...authStore.currentCredentials]
+ if (authStore.userInfo) {
+ authStore.userInfo = { ...authStore.userInfo }
+ }
}, 60000) // Update every minute
})
@@ -101,12 +102,12 @@ onUnmounted(() => {
})
const getCredentialAuthName = (credential) => {
- const authInfo = authStore.aaguidInfo[credential.aaguid]
+ const authInfo = authStore.userInfo?.aaguid_info?.[credential.aaguid]
return authInfo ? authInfo.name : 'Unknown Authenticator'
}
const getCredentialAuthIcon = (credential) => {
- const authInfo = authStore.aaguidInfo[credential.aaguid]
+ const authInfo = authStore.userInfo?.aaguid_info?.[credential.aaguid]
if (!authInfo) return null
const isDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
diff --git a/frontend/src/components/AddCredentialView.vue b/frontend/src/components/ResetView.vue
similarity index 78%
rename from frontend/src/components/AddCredentialView.vue
rename to frontend/src/components/ResetView.vue
index a1979fb..6190e62 100644
--- a/frontend/src/components/AddCredentialView.vue
+++ b/frontend/src/components/ResetView.vue
@@ -1,8 +1,9 @@
-
🔑 Add Device Credential
-
👤 {{ authStore.currentUser.user_name }}
+
🔑 Add New Credential
+
👤 {{ authStore.userInfo?.user?.user_name }}
+
Proceed to complete {{authStore.userInfo?.session_type}}: