Task #60
openUser Profile Creation on Login (Auto-Create & Manage Profile)
0%
Description
Implement a feature where a user profile is automatically created when a user logs in for the first time (normal login or Google authentication). The system should store basic user details and allow the user to view and update their profile from the Profile page. This ensures every user has a complete profile linked to their account.
Tables Used (Reference Existing)
***users
Field Description
id (PK) User ID
email User email
full_name User name
phone_number User phone number
role_id (FK roles.id) Assigned role
is_active Active/inactive
created_at Account created time
***user_profiles
Field Description
id (PK) Profile ID
user_id (FK users.id) Linked user
address User address
state State name
district District name
place City/Area
profile_image Profile photo (optional)
bio Short description (optional)
created_at Created timestamp
updated_at Last updated timestamp
***locations
Field Description
id (PK) Location ID
parent_id Parent location
name Location name
type State/District/City/Area
is_active Active/inactive
***Validations
***Auto-Creation Logic
*On first successful login:
*Check if profile exists for user_id
*If not → create a default profile record in user_profiles
***User-Side Validations
*Full Name – Mandatory, minimum 3 characters
*Phone Number – Mandatory, numeric, 10–15 digits
*Email – Read-only (cannot be edited)
*Address – Optional, max 255 characters
*State / District / Place – Optional, must be active locations if selected
***System Rules
*User can only view/edit their own profile
*Profile must be linked to users.id
*Inactive users cannot update profile
*Location dropdowns must load only active locations