Private
Public Access
1
0

Add profile management (display name, email, password change, account deletion)

Full-stack profile section: DisplayName column on User model, profile CRUD
endpoints on AuthController, and complete Settings > Profile tab UI with
profile editing, password change, account info, and account deletion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Catherine Renelle
2026-02-09 22:44:52 -05:00
parent 0562bb97b7
commit 1ceeca0fb6
12 changed files with 2250 additions and 175 deletions
+20 -1
View File
@@ -7,6 +7,7 @@ export const useAuthStore = defineStore('auth', () => {
const token = ref<string | null>(null)
const refreshTokenValue = ref<string | null>(null)
const username = ref<string | null>(null)
const displayName = ref<string | null>(null)
const expiresAt = ref<string | null>(null)
const isAuthenticated = computed(() => !!token.value)
@@ -15,6 +16,7 @@ export const useAuthStore = defineStore('auth', () => {
token.value = localStorage.getItem('purrse_token')
refreshTokenValue.value = localStorage.getItem('purrse_refresh_token')
username.value = localStorage.getItem('purrse_username')
displayName.value = localStorage.getItem('purrse_display_name')
expiresAt.value = localStorage.getItem('purrse_expires_at')
}
@@ -22,10 +24,16 @@ export const useAuthStore = defineStore('auth', () => {
token.value = auth.token
refreshTokenValue.value = auth.refreshToken
username.value = auth.username
displayName.value = auth.displayName
expiresAt.value = auth.expiresAt
localStorage.setItem('purrse_token', auth.token)
localStorage.setItem('purrse_refresh_token', auth.refreshToken)
localStorage.setItem('purrse_username', auth.username)
if (auth.displayName) {
localStorage.setItem('purrse_display_name', auth.displayName)
} else {
localStorage.removeItem('purrse_display_name')
}
localStorage.setItem('purrse_expires_at', auth.expiresAt)
}
@@ -45,16 +53,27 @@ export const useAuthStore = defineStore('auth', () => {
setAuth(data)
}
function setDisplayName(name: string | null) {
displayName.value = name
if (name) {
localStorage.setItem('purrse_display_name', name)
} else {
localStorage.removeItem('purrse_display_name')
}
}
function logout() {
token.value = null
refreshTokenValue.value = null
username.value = null
displayName.value = null
expiresAt.value = null
localStorage.removeItem('purrse_token')
localStorage.removeItem('purrse_refresh_token')
localStorage.removeItem('purrse_username')
localStorage.removeItem('purrse_display_name')
localStorage.removeItem('purrse_expires_at')
}
return { token, username, expiresAt, isAuthenticated, initialize, login, register, refreshToken, logout }
return { token, username, displayName, expiresAt, isAuthenticated, initialize, login, register, refreshToken, setDisplayName, logout }
})