From f9bb9d4b555eb20b9c9b6e1f61c2d4736538092a Mon Sep 17 00:00:00 2001
From: Padreug
Date: Sat, 2 May 2026 17:24:13 +0200
Subject: [PATCH] feat(profile): add Log out button + confirmation dialog
The Profile sheet (mounted as the Profile dock slot in Hub.vue and
elsewhere) had no way to log out. Added a LogoutConfirmDialog at
the bottom of ProfileSettings.vue, separated from the form by a
horizontal divider. Confirming the dialog:
1. calls auth.logout() (clears the LNbits token + Nostr session)
2. toasts "Logged out"
3. routes to /login on the current app's origin
Reuses the existing LogoutConfirmDialog component
(src/components/ui/LogoutConfirmDialog/) so the styling and
behaviour match wherever a logout affordance already exists in the
codebase.
Co-Authored-By: Claude Opus 4.7 (1M context)
---
.../base/components/ProfileSettings.vue | 31 ++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/src/modules/base/components/ProfileSettings.vue b/src/modules/base/components/ProfileSettings.vue
index d1dab22..732863a 100644
--- a/src/modules/base/components/ProfileSettings.vue
+++ b/src/modules/base/components/ProfileSettings.vue
@@ -147,6 +147,19 @@
Use the "Broadcast to Nostr" button to manually re-broadcast your profile.
+
+
+
+
+
+
+ Logging out clears your session on this device.
+
+
@@ -168,14 +181,17 @@ import {
FormMessage,
} from '@/components/ui/form'
import ImageUpload from './ImageUpload.vue'
+import LogoutConfirmDialog from '@/components/ui/LogoutConfirmDialog/LogoutConfirmDialog.vue'
import { useAuth } from '@/composables/useAuthService'
+import { useRouter } from 'vue-router'
import { injectService, SERVICE_TOKENS } from '@/core/di-container'
import type { ImageUploadService } from '../services/ImageUploadService'
import type { NostrMetadataService } from '../nostr/nostr-metadata-service'
import { useToast } from '@/core/composables/useToast'
// Services
-const { user, updateProfile } = useAuth()
+const { user, updateProfile, logout } = useAuth()
+const router = useRouter()
const imageService = injectService(SERVICE_TOKENS.IMAGE_UPLOAD_SERVICE)
const metadataService = injectService(SERVICE_TOKENS.NOSTR_METADATA_SERVICE)
const toast = useToast()
@@ -322,4 +338,17 @@ const broadcastMetadata = async () => {
isBroadcasting.value = false
}
}
+
+// Log out + redirect to /login on this app's origin.
+const onLogout = async () => {
+ try {
+ await logout()
+ toast.success('Logged out')
+ router.push('/login')
+ } catch (error) {
+ const errorMessage = error instanceof Error ? error.message : 'Failed to log out'
+ console.error('Error logging out:', error)
+ toast.error(`Logout failed: ${errorMessage}`)
+ }
+}