Add display name to profile settings: User type, updateDisplayName API, ProfileSettings

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Usman Baig
2026-02-08 01:50:33 +01:00
parent 77cb9eaed1
commit d96f7cf1a4
5 changed files with 22 additions and 6 deletions

View File

@@ -4,7 +4,7 @@ import { useAuth } from '@/lib/auth/context'
import { ProfileSettings as SharedProfileSettings } from '@ciphera-net/ui' import { ProfileSettings as SharedProfileSettings } from '@ciphera-net/ui'
import api from '@/lib/api/client' import api from '@/lib/api/client'
import { deriveAuthKey } from '@/lib/crypto/password' import { deriveAuthKey } from '@/lib/crypto/password'
import { deleteAccount, getUserSessions, revokeSession, updateUserPreferences } from '@/lib/api/user' import { deleteAccount, getUserSessions, revokeSession, updateUserPreferences, updateDisplayName } from '@/lib/api/user'
import { setup2FA, verify2FA, disable2FA, regenerateRecoveryCodes } from '@/lib/api/2fa' import { setup2FA, verify2FA, disable2FA, regenerateRecoveryCodes } from '@/lib/api/2fa'
export default function ProfileSettings() { export default function ProfileSettings() {
@@ -37,6 +37,7 @@ export default function ProfileSettings() {
<SharedProfileSettings <SharedProfileSettings
user={user} user={user}
onUpdateProfile={handleUpdateProfile} onUpdateProfile={handleUpdateProfile}
onUpdateDisplayName={updateDisplayName}
onUpdatePassword={handleUpdatePassword} onUpdatePassword={handleUpdatePassword}
onDeleteAccount={deleteAccount} onDeleteAccount={deleteAccount}
onSetup2FA={setup2FA} onSetup2FA={setup2FA}

View File

@@ -58,3 +58,10 @@ export async function updateUserPreferences(preferences: UserPreferences): Promi
body: JSON.stringify(preferences), body: JSON.stringify(preferences),
}) })
} }
export async function updateDisplayName(displayName: string): Promise<void> {
return apiRequest<void>('/auth/user/display-name', {
method: 'PUT',
body: JSON.stringify({ display_name: displayName }),
})
}

View File

@@ -10,9 +10,17 @@ import { getUserOrganizations, switchContext } from '@/lib/api/organization'
interface User { interface User {
id: string id: string
email: string email: string
display_name?: string
totp_enabled: boolean totp_enabled: boolean
org_id?: string org_id?: string
role?: string role?: string
preferences?: {
email_notifications?: {
new_file_received: boolean
file_downloaded: boolean
security_alerts: boolean
}
}
} }
interface AuthContextType { interface AuthContextType {

8
package-lock.json generated
View File

@@ -8,7 +8,7 @@
"name": "pulse-frontend", "name": "pulse-frontend",
"version": "0.1.3", "version": "0.1.3",
"dependencies": { "dependencies": {
"@ciphera-net/ui": "^0.0.46", "@ciphera-net/ui": "^0.0.47",
"@ducanh2912/next-pwa": "^10.2.9", "@ducanh2912/next-pwa": "^10.2.9",
"axios": "^1.13.2", "axios": "^1.13.2",
"country-flag-icons": "^1.6.4", "country-flag-icons": "^1.6.4",
@@ -1467,9 +1467,9 @@
} }
}, },
"node_modules/@ciphera-net/ui": { "node_modules/@ciphera-net/ui": {
"version": "0.0.46", "version": "0.0.47",
"resolved": "https://npm.pkg.github.com/download/@ciphera-net/ui/0.0.46/852ce8d0289505c3d3f625a0f076bfb3fb03ef9f", "resolved": "https://npm.pkg.github.com/download/@ciphera-net/ui/0.0.47/515f5980070b669351583081909e684cd4e1ad04",
"integrity": "sha512-ZYu1u07B1ROYFYFznWQk2sShSqhFpPKNPCBUjqqElTP5hMYX0jVAnVIzqXUugdLl7E8luwvL6Lx+dOaN4oPORg==", "integrity": "sha512-Gn2Qgy7p+Qo0Ko92nVs3RbQGQHDcolm+EHVCGzRDyFiZXMW7mgV+yFoUOxdq2sOqcbiIiZOZU+r59inXk1Xe2g==",
"dependencies": { "dependencies": {
"@radix-ui/react-icons": "^1.3.0", "@radix-ui/react-icons": "^1.3.0",
"clsx": "^2.1.0", "clsx": "^2.1.0",

View File

@@ -10,7 +10,7 @@
"type-check": "tsc --noEmit" "type-check": "tsc --noEmit"
}, },
"dependencies": { "dependencies": {
"@ciphera-net/ui": "^0.0.46", "@ciphera-net/ui": "^0.0.47",
"@ducanh2912/next-pwa": "^10.2.9", "@ducanh2912/next-pwa": "^10.2.9",
"axios": "^1.13.2", "axios": "^1.13.2",
"country-flag-icons": "^1.6.4", "country-flag-icons": "^1.6.4",