This guide will help you test the new functionality where users who log in without a Master Password set will be prompted to create one.
- Running dev server (
npm run dev) - Access to Supabase dashboard to check database state
- Test user accounts (both new and existing)
Goal: Verify that a new user is prompted to set up a Master Password after first login.
Steps:
- Navigate to
http://localhost:3000/login - Click "Sign up" to create a new account
- Complete registration with a new email/password
- After successful registration, log in with the new credentials
- Expected Result: You should be redirected to
/master-password?setup=true - Expected UI:
- Page title: "Set Master Password"
- Description: "Create a master password to encrypt your credentials..."
- Two password fields: "Master Password" and "Confirm Master Password"
- Minimum 12 characters requirement shown
- Enter a master password (min 12 characters) and confirm it
- Click "Set Master Password"
- Expected Result: Redirected to
/vaultwith access to the vault
Database Verification:
- Check
vault_userstable in Supabase - Should see a new row with
user_idmatching your user andmaster_password_hashpopulated
Goal: Verify that existing users are prompted to unlock their vault.
Steps:
- Log out if currently logged in
- Navigate to
http://localhost:3000/login - Log in with an existing account that already has a master password set
- Expected Result: Redirected to
/master-password(without?setup=true) - Expected UI:
- Page title: "Unlock Vault"
- Description: "Enter your master password to unlock the vault."
- Single password field: "Master Password"
- Enter the correct master password
- Click "Unlock Vault"
- Expected Result: Redirected to
/vaultwith access to credentials
Goal: Verify that new users logging in via Google are prompted to set up Master Password.
Steps:
- Navigate to
http://localhost:3000/login - Click "Sign in with Google"
- Complete Google OAuth flow with a NEW Google account (not previously used)
- Expected Result: After OAuth callback, redirected to
/master-password?setup=true - Follow same steps as Scenario 1 to set up master password
Goal: Verify that existing Google OAuth users are prompted to unlock vault.
Steps:
- Log out if currently logged in
- Navigate to
http://localhost:3000/login - Click "Sign in with Google"
- Complete Google OAuth flow with an account that already has a master password
- Expected Result: Redirected to
/master-password(unlock mode) - Follow same steps as Scenario 2 to unlock vault
- Log in as existing user
- At unlock screen, enter incorrect master password
- Expected Result: Error message displayed, user remains on unlock page
- Log in as new user
- At setup screen, try to enter password less than 12 characters
- Expected Result: Validation error shown
- Log in as new user
- At setup screen, enter different passwords in the two fields
- Expected Result: Error message "Passwords do not match"
- While logged out, try to access
http://localhost:3000/vaultdirectly - Expected Result: Redirected to
/login - After login (as new user), should go through master password setup flow
SELECT
u.email,
vu.master_password_hash IS NOT NULL as has_master_password,
vu.created_at,
vu.master_password_verified_at
FROM auth.users u
LEFT JOIN vault_users vu ON u.id = vu.user_id
WHERE u.email = 'your-test-email@example.com';SELECT
u.email,
vu.created_at as master_password_created_at,
vu.master_password_verified_at
FROM vault_users vu
JOIN auth.users u ON vu.user_id = u.id
ORDER BY vu.created_at DESC;Solution: Clear browser cookies and try again. The middleware uses cookies to track authentication state.
Solution: This is a timing issue. The login API includes a 1-second delay to ensure cookies are written. If this persists, increase the delay in app/(auth)/login/page.tsx line 58.
Solution: Check Supabase logs for RLS policy errors. Ensure the authenticated user has INSERT permissions on vault_users table.
✅ New users (email/password) are prompted to set up master password
✅ New users (Google OAuth) are prompted to set up master password
✅ Existing users (email/password) are prompted to unlock vault
✅ Existing users (Google OAuth) are prompted to unlock vault
✅ Master password hash is correctly saved to database
✅ Users can access vault after setting/entering master password
✅ Middleware correctly enforces authentication and master password unlock
app/api/auth/login/route.ts- Added master password check for email/password loginapp/api/auth/callback/route.ts- Added master password check for OAuth callback