# Task 1: Fix SettingsModule - Add Edit Profile, Change Password, Privacy with API Integration

## Agent: Main

## Work Completed

### API Routes Created

1. **`/src/app/api/auth/profile/route.ts`** (PATCH)
   - Accepts: `userId`, `name`, `phone`, `bio`, `address`, `division`, `district`, `upazila`, `avatar`
   - Validates user exists, updates only provided fields
   - Returns updated user (without password) with roles as array

2. **`/src/app/api/auth/change-password/route.ts`** (POST)
   - Accepts: `userId`, `currentPassword`, `newPassword`
   - Validates current password using base64 hash (same method as auth route)
   - Minimum 8 character validation on new password
   - Returns success/error message

3. **`/src/app/api/auth/forgot-password/route.ts`** (POST)
   - Accepts: `email`
   - Resets password to default "Reset@1234"
   - Returns generic message to prevent email enumeration

### SettingsModule Updated

Three new dialogs added:

1. **Edit Profile Dialog** - Triggered by "Edit Profile" menu item
   - Fields: Name, Phone, Bio (textarea), Address, Division (select), District (cascading), Upazila (cascading)
   - Pre-populates from current user data
   - Calls PATCH /api/auth/profile, updates Zustand store on success
   - Login required check with toast

2. **Change Password Dialog** - Triggered by "Change Password" menu item
   - Fields: Current Password, New Password, Confirm New Password
   - Client-side validation: password match, minimum length
   - Calls POST /api/auth/change-password
   - Login required check with toast

3. **Privacy Dialog** - Triggered by "Privacy" menu item
   - Toggles: Profile Visibility (Public/Private), Show Phone, Show Email, Show Address
   - Saves to localStorage (`needyfy-privacy-settings`)
   - Shows toast on each toggle change

### Key Implementation Details
- All dialogs have DialogTitle + DialogDescription for accessibility
- Uses shadcn/ui Dialog, Input, Label, Button, Switch, Textarea, Select
- Uses `useToast` from `@/hooks/use-toast` for notifications
- Uses `useAppStore` for user state (user, setUser, isLoggedIn)
- Imports `bangladeshDivisions`, `getDistricts`, `getUpazilas` from `@/lib/bangladesh-locations`
- All existing settings preserved (dark mode, language, notifications, danger zone)

## Verification
- Lint passes with zero errors
- Dev server compiles successfully
