Overview
The Studley AI account system allows you to manage your personal information, customize your profile, and control your account settings. Your profile data is stored in both theusers and profiles tables for optimal performance.
User Profiles
Profile Data Structure
Your profile contains:- First Name: Your given name
- Last Name: Your family name
- Full Name: Automatically combined from first and last name
- Email: Your verified email address
- Avatar URL: Profile picture stored in Vercel Blob
- Created At: Account creation timestamp
Database Tables
users table:- Stores core user information
- Contains
id,email,first_name,last_name,name,created_at - Primary source for authentication
- Stores extended profile data
- Contains
id,full_name,username,avatar_url,updated_at,created_at - Used for display purposes and customization
Accessing Profile Settings
Updating Personal Information
Navigate to Personal Information
In the Settings page, find the “Personal Information” section with the user icon.
Edit Your Name
Update your first name and/or last name in the input fields. Both fields are required (marked with *).
Profile changes sync immediately across all dashboard components. Other users will see your updated name on shared content.
Avatar Upload
Uploading a Profile Picture
Select Image
Choose an image file from your device:
- Supported formats: JPG, PNG, GIF
- Maximum size: 5MB
- Validation: Must be a valid image file
Avatar Display
Your avatar is displayed:- In the dashboard sidebar
- On profile dropdown menus
- Next to your library items
- On shared content as the creator
Removing an Avatar
Currently, avatars can only be replaced, not removed. Upload a new image to replace your current avatar.Email Management
Viewing Your Email
Your email address is displayed in the “Email Address” section of Settings. It’s shown as read-only.Changing Your Email
Email changes require support assistance for security:- Contact support at
[email protected] - Provide verification of your identity
- Support will update your email and send confirmation
Direct email changes are disabled to prevent account takeover. This security measure protects your account and content.
Password Management
Changing Your Password
Navigate to Change Password
In Settings, scroll to the “Change Password” section with the lock icon.
Enter Current Password
Type your current password in the first field. Click the eye icon to show/hide your password.
Enter New Password
Type your new password:
- Minimum length: 6 characters
- Use a strong, unique password
- Avoid common words or patterns
After changing your password, you’ll remain logged in on your current device. Other devices will require login with the new password.
Account Settings Features
Profile Dropdown
Click your avatar in the sidebar to access:- Quick view of your name and email
- Link to Settings page
- Logout button
Real-time Updates
When you update your profile:- Changes save to the database
- A
userProfileUpdatedevent is dispatched - Dashboard components listen for this event
- UI updates immediately without page refresh
Success and Error Messages
The Settings page shows animated notifications:- Success (green): Changes saved successfully
- Error (red): Validation or save errors
- Auto-dismiss: Messages disappear after 3 seconds
Database Schema
users table
profiles table
Row Level Security (RLS)
Both tables have RLS policies:- SELECT: Users can read their own profile
- UPDATE: Users can update their own profile
- INSERT: Users can create their own profile
Auto-Profile Creation
When you sign up:- Supabase Auth creates your authentication record
-
The signup API inserts your record into
userstable:id: Matches your auth user IDemail: Your verified emailfirst_name,last_name: From signup formname: Combined full namecreated_at: Current timestamp
- Profile is created automatically on first settings access
Account Deletion
Deletion Process
To delete your account:Open Danger Zone
Navigate to Settings and scroll to the “Danger Zone” section at the bottom (red border).
Contact Support
Account deletion requires support verification:
- Click “Email Support” in the modal
- This opens your email client with a pre-filled subject
- Alternatively, email
[email protected]directly
Account deletion is permanent and cannot be undone. All your quizzes, flashcards, study guides, and settings will be permanently deleted.
API Endpoints
Get Current User
- Endpoint:
GET /api/auth/user - Response:
{ user: { id, username, fullName, isVerified } }
Upload Avatar
- Endpoint:
POST /api/upload-avatar - Body: FormData with
filefield - Response:
{ url: string } - Max Size: 5MB
- Formats: JPG, PNG, GIF
Troubleshooting
Profile not loading?
- Refresh the page to reload profile data
- Check your internet connection
- Try logging out and back in
Avatar upload failing?
- Ensure image is under 5MB
- Use JPG, PNG, or GIF format
- Check file isn’t corrupted
- Try a different image
Name changes not reflecting?
- Wait a few seconds for database sync
- Refresh the page
- Check both first and last name are filled
Can’t update password?
- Verify new password is at least 6 characters
- Ensure passwords match exactly
- Check you’re entering correct current password