feat: update authentication and profile management features
- Enhanced login response to include additional user information such as email, tier, and role. - Updated profile update logic to restrict access based on user roles and ensure only authorized users can modify profiles. - Replaced ProfilePage with AccountSettingsPage in routing and updated related components to reflect this change. - Added new API functions for updating profiles and changing passwords to improve user account management.
This commit is contained in:
1 parent
d9d2d9e506
commit
fae673670a
10 files changed
+283
-73
No files matched your search
@@ -29,8 +29,24 @@ export function AuthProvider({ children }) {
|
||||
}
|
||||
}
|
||||
|
||||
const login = (data) => {
|
||||
setUser(data.profile || data)
|
||||
/** Fallback, falls ohne checkAuth gesetzt wird (Legacy / Token-Injektion) */
|
||||
const login = (payload) => {
|
||||
if (payload?.profile != null) {
|
||||
setUser(payload.profile)
|
||||
return
|
||||
}
|
||||
const p = payload
|
||||
if (p?.profile_id != null || p?.id != null) {
|
||||
setUser({
|
||||
id: p.profile_id ?? p.id,
|
||||
name: p.name ?? null,
|
||||
email: p.email ?? null,
|
||||
role: p.role ?? 'user',
|
||||
tier: p.tier ?? 'free',
|
||||
})
|
||||
return
|
||||
}
|
||||
setUser(payload)
|
||||
}
|
||||
|
||||
const logout = () => {
|
||||
|
||||
Reference in new issue
Block a user