Appearance
Profile Management ​
File Information ​
- Path:
app/pages/[brand_name]/profile.vue,app/composables/core/pages/useProfile.ts - Purpose: User profile management system
Overview ​
The Profile Management system allows users to view and manage their profile information. It provides comprehensive profile management features including profile image upload, name editing, notification preferences, and password change functionality.
Architecture ​
System Components ​
- Profile Page: Display and edit user profile
- Profile Image Upload: Upload and manage profile images
- Profile Editing: Edit profile information
- Notification Settings: Manage notification preferences
- Password Change: Change user password
Key Features ​
1. Profile Display ​
- User profile image (with avatar fallback)
- User name and email display
- Profile image upload
- Image preview
- Profile information display
2. Profile Editing ​
- Full name editing
- Real-time validation
- Form state management
- Cancel functionality
- Save changes
3. Profile Image Upload ​
- Image file selection
- Image preview before upload
- File type validation (images only)
- File size validation (4MB max)
- Image upload with progress
- Cache-busting for updated images
4. Notification Settings ​
- Digital Asset Management email notification toggle
- Tooltip with explanation
- Preference persistence
- Real-time preference updates
5. Password Change ​
- Old password input
- New password input
- Confirm password input
- Password validation (minimum 6 characters)
- Password match validation
- Form validation
File Structure ​
Core Files ​
Vue Page Files (.vue) ​
app/pages/[brand_name]/profile.vue- Profile page- Profile display
- Profile editing
- Image upload
- Notification settings
- Password change
Route: /{brand_name}/profile
Composables ​
app/composables/core/pages/useProfile.ts- Profile composable- Profile data management
- Profile updates
- Image upload handling
- Password change
- Form validation
API ​
app/composables/api/useProfileApi.ts- Profile API operations- Get profile
- Update profile
- Change password
Data Flow ​
Profile Loading ​
- Page mounts
- User profile data fetched from auth store
- Form fields populated
- Avatar character set (if no image)
- Initial data stored for comparison
Profile Update ​
- User edits profile information
- Form validates in real-time
- User clicks save
- FormData built with profile data
- API called to update profile
- Success message displayed
- Profile image updated with cache-busting
- Events emitted for header updates
Password Change ​
- User enters old and new passwords
- Form validates in real-time
- User clicks change password
- API called to change password
- Success message displayed
- Form reset
User Interactions ​
Profile Image
- Click to upload new image
- Image preview before upload
- Validation (image type, 4MB max)
Profile Editing
- Edit full name
- Real-time validation
- Save changes
- Cancel changes (resets form)
Notification Settings
- Toggle notification preference
- Tooltip with explanation
- Preference saved with profile
Password Change
- Enter old password
- Enter new password
- Confirm new password
- Real-time validation
- Submit password change
Form Validation ​
Name Validation ​
- Required field
- Format validation using
validateFullNamehelper - Real-time error display
Password Validation ​
- All fields required
- Password minimum 6 characters
- Confirm password must match password
- Real-time validation
Image Validation ​
- File must be an image
- File size must be ≤ 4MB
- Creates data URL preview
API Endpoints ​
Update User Profile ​
- Endpoint:
PUT /user/profile(viaupdateUserProfile()) - Request: FormData with id, instance_id, profile_image, name, phone, enable_notification
- Response: Updated user data with profile_image
Change User Password ​
- Endpoint:
POST /user/change-password(viachangeUserPasswordApi()) - Request: old_password, password
- Response: Success message
Performance Optimizations ​
- Image Preview: Uses FileReader for client-side preview
- Cache Busting: Adds timestamp to image URL to force refresh
- Form State: Tracks initial state to detect changes
- Validation: Real-time validation prevents unnecessary API calls
Related Documentation ​
- Profile Page - Profile page documentation
- useProfile Composable - Profile composable
- Profile API - Profile API endpoints
- Auth Store - Authentication store