Table of Contents
02 — Profiles, settings and account lifecycle
Technical reference. For task-based help, see the corresponding user guide.
Documentation status: complete for the current implementation
Reviewed: 2026-07-21
Primary users: family members and coaches
Surfaces: mobile web app, coach admin portal and platform API
Purpose
This feature lets a signed-in person maintain the identity and preferences attached to their account. It covers family and coach profile details, private profile media, family timezone, appearance, communication choices, password changes, legal links, logout and permanent family-account deletion.
Baby profiles have a separate lifecycle and are documented in Feature 06. Practice-wide branding and team labels are documented in Feature 23 and Feature 26.
User outcomes
| User | Outcome |
|---|---|
| Family member | Change their display name, relationship to the baby, profile image, timezone, appearance and communications choices. |
| Coach | Keep their coach name, practice/business name and profile image current from either mobile or the coach portal. |
| Signed-in user | Change a password, open current legal documents, or log out. |
| Family member leaving the service | Permanently delete the account after an explicit, identity-matching confirmation. |
Entry points
| Surface | Entry point | Function |
|---|---|---|
| Family mobile | Home menu → Edit Profile | Name, relationship and profile image. Email is displayed read-only. |
| Family mobile | /family/settings | Appearance, family timezone and communication preferences. |
| Family mobile | /family/change-password | Signed-in password update. |
| Family mobile | /family/terms and /family/privacy | Embedded legal pages with an external-open fallback. |
| Family mobile | Home menu → Logout or Delete Account | End the local session or begin destructive account removal. |
| Coach mobile | Coach menu → Edit Profile | Coach name, business name and profile image; email is read-only. |
| Coach admin portal | /account | Practice profile, image and password controls. |
Profile editing
Family profile
- Name is required and trimmed by the platform before it is stored.
- Email identifies the authenticated account and is read-only in this editor.
- Relationship can be Mother, Father, Grandfather, Grandmother, Uncle, Aunt, Guardian or Other.
- Selecting a profile image creates an immediate local preview, then uploads the image to the private
profile-imagesbucket through a short-lived signed upload URL. - Saving sends only trusted profile fields to
PATCH /auth/profile. A signed download URL is requested when the image is displayed later. - A failed image upload leaves the existing profile usable and reports a retryable error rather than saving a broken public URL.
Coach profile
- The mobile editor requires the coach name and, when the business-name field is available, the business name.
- The coach portal calls the same profile endpoint and requires both Coach name and Practice name.
- A coach can select or remove a square image/logo. The portal validates that the chosen file is an image, compresses supported formats, obtains a 15-minute signed upload, and saves the resulting private object path.
- Updating
businessNamechanges the owning coach's practice/organization name as part of the trusted platform profile operation. - The coach email is displayed but cannot be changed from these screens.
Settings behavior
Appearance
The mobile settings screen exposes the app theme preference and its resolved appearance. This preference is a client presentation choice; it does not grant access or alter server data.
Family timezone
- The family can choose an IANA timezone from the settings list or use the timezone detected from the current device.
- Saving calls
PATCH /auth/profilewith the current profile name and chosen timezone. - The timezone defines the family's day boundary and the times shown to coaches.
- Existing activities retain the timezone/local-date metadata captured when they were written; changing the family timezone does not rewrite historical logs.
- The update button is disabled until the value changes. Success and recoverable failure messages are announced on the page.
Communication preferences
Three independent, opt-in switches are available:
- hints and tips;
- app updates and new features;
- promotions and offers.
All three default to off. The screen refreshes the current trusted session before editing, sends a partial strict request to PATCH /auth/communication-preferences, and updates its saved baseline after success. A network or API error leaves the draft visible for another attempt.
Password, legal pages and logout
- Family and coach password forms require the current password, a new password of at least eight characters and matching confirmation.
- The coach portal hides the password inputs until Update password is chosen and reports when password updates are unavailable in the current auth environment.
- Password changes are handled by the authenticated Supabase client; passwords are never sent to the Littles Baby Tracker profile endpoint.
- Terms and Privacy screens load the configured public document URL in an iframe and provide an explicit external-open button if the embedded view is unsuitable.
- Logout clears local product state and signs out the Supabase session even when a remote sign-out response cannot be completed. It does not delete product data.
Permanent account deletion
Deletion is intentionally available only in the family's self-mode menu. It is not shown while a coach is viewing a family and is not a general coach-admin action.
- The screen states that the family profile, babies, activities, allergy ladders and coach access will be removed and that the operation cannot be undone.
- The user must enter the account email; comparison is case-insensitive and must match the signed-in subject email.
- The user must also type the exact uppercase confirmation word
DELETE. DELETE /auth/accountrepeats schema and identity checks on the server. The API removes the product account and asks the auth administrator to remove every linked auth identity returned by the deletion transaction.- On success the app logs out and returns to the signed-out flow. On failure the destructive form remains open and displays the platform error.
Current implementation note: family self-service deletion is reachable in mobile. The coach portal currently provides profile, image and password management but no coach self-delete control.
Validation and user-visible states
| State | Expected behavior |
|---|---|
| Initial settings load | Fetch the latest session and keep save actions disabled while loading. |
| Empty required name/business name | Prevent submission and identify the missing field. |
| Non-image profile file | Reject locally before requesting an upload. |
| Image upload failure | Preserve the existing profile, clear the invalid pending image and offer a retryable error. |
| No timezone change | Keep Update timezone disabled. |
| Preference save failure | Keep the draft choices and report that the update could not be completed. |
| Password mismatch or fewer than eight characters | Do not call the auth provider; show corrective copy. |
| Legal document cannot open externally | Keep the screen usable and report the open failure. |
| Delete confirmation incomplete | Keep Delete account disabled. |
Platform API contract
| Method and path | Role in this feature | Authentication |
|---|---|---|
GET /auth/me | Refresh the current actor, roles, profile and communication metadata. | Signed-in identity |
PATCH /auth/profile | Update name, business name, private profile asset, relationship or timezone. | Signed-in identity; field/ownership checks |
PATCH /auth/communication-preferences | Update one or more opt-in choices. | Signed-in identity |
DELETE /auth/account | Permanently remove the confirmed family product/auth account. | Signed-in identity plus matching email and DELETE |
POST /files/signed-upload-url | Issue a short-lived private upload grant for an allowed image path. | Signed-in, object-scoped identity |
POST /files/signed-download-url | Issue a short-lived private display URL for an authorized profile image. | Signed-in, object-scoped identity |
Authorization and privacy rules
- Supabase Auth remains the identity/password authority; the platform API remains the profile and tenant authorization boundary.
- Private storage paths, not public image URLs, are saved in profiles. Every upload/download request is scoped and re-authorized.
- A coach viewing a family cannot edit the family's user profile, timezone, preferences, password or account lifecycle controls.
- Business-name changes are limited to the coach owner context allowed by the platform.
- Communication preferences are separate booleans and never inferred from accepting required legal terms.
- Owner view-as sessions remain read-only for normal profile mutations.
Acceptance checklist
- A family can update name, relationship and profile image without changing its email identity.
- A coach can update coach/practice names and add or remove a private profile image.
- Family timezone changes affect future day-boundary behavior but do not rewrite stored activities.
- Communication switches load their saved values and persist independently.
- Password validation runs before the auth-provider call and a successful change clears the form.
- Logout ends the local session without deleting data.
- Account deletion remains disabled until both email and exact confirmation match, then signs the deleted user out.
- Coach view-as never exposes the family's logout, password or deletion controls.
Source evidence
Mobile web
mobile-web/src/routes/SettingsScreen.tsxmobile-web/src/components/FamilySideMenu.tsxmobile-web/src/components/CoachSideMenu.tsxmobile-web/src/routes/FamilyAccountActionScreen.tsxmobile-web/src/routes/ChangePasswordScreen.tsxmobile-web/src/utils/image-upload.ts
Coach portal
admin-web/src/routes/AccountPanel.tsxadmin-web/src/api/supabase-auth.ts
Platform and contracts
platform/apps/api/src/routes/auth-routes.tsplatform/apps/api/src/routes/file-routes.tsplatform/packages/shared/src/auth.tsplatform/packages/shared/src/communication-preferences.tsplatform/docs/multi-tenancy/05-development-plan.md
