User Flow Reference
Every path a person can take to become an active user, with verbatim copy from each screen, email, and SMS — pulled from the live code.
Five entry paths
- Public Sign-Up Form — family fills out
signup.htmlon their own - Admin sends an Invite — admin uses
admin-invites.html - User Logs In for the First Time — applies to paths 1 + 2
- Admin Converts a Pending Invite
- Admin Adds a User Directly
Outbound notifications
- All emails & texts the system sends — verbatim copy
Public Sign-Up Form
A new family discovers the troop website and clicks "Join Us." They fill out a multi-step form (3 steps for trailman families, 1 step for volunteers/friends) that creates a pending invite. An admin gets an email notification.
Top of the page shows a 3-dot step indicator (1 → 2 → 3) and the troop branding "Troop TX-0139 / Sign Up".
Always shown. The role select uses two optgroups, "Family of a Trailman" and "No Trailman." Selecting a male role reveals the leader-interest checkbox.
Parent / Guardian Information
Tell us about yourself so we can set up your family account.
No Trailman: Male Volunteer — no trailmen · Friend of the Troop — donor / supporter
I'm interested in volunteering for a leadership role. (only shown for male roles)
Communication Preferences
How would you like to receive troop announcements and updates?
Email me troop announcements and updates.
Text me troop announcements and updates at the phone number above.By keeping this box checked, I consent to receive SMS text messages from Troop TX-0139 (Grace Trail Life) about troop events, announcements, and reminders. Message frequency varies. Message & data rates may apply. Reply STOP to unsubscribe or HELP for help at any time.
NextcheckSignupContact with the email and phone. If email OR phone matches an existing user, an error appears and the form blocks: "You already have an account with this [email / phone number]. Log in here to add a trailman or update your info." The check fails open if the function errors.
maleVolunteer or friend, the form skips Steps 2 and 3 entirely and calls submitSignup([], []) immediately on clicking Next.
Skipped for volunteers/friends. One trailman is shown by default; the parent can add more via the + Add Another Trailman button. All four fields per trailman are required.
Trailman Information
Tell us about the boy(s) you'd like to sign up. You can add more than one.
Trailman 1
Both label texts ("Grade for the upcoming school year" / "School for the upcoming school year") are dynamic — they change to "Grade entering Fall 2026 / School attending Fall 2026" once the date triggers the next program year.
Skipped for volunteers/friends. The page begins empty with just the explainer + Add button. Each added family-member block captures First Name + Last Name (required), Relationship dropdown (Father / Mother / Grandfather / Grandmother / Other Male Family / Other Female Family — no Volunteer / Friend options here), Email + Phone (both optional), plus a leader-interest checkbox that appears only for male roles ("Interested in volunteering for a leadership role.").
Additional Family Members
Would you like to add other family members to your account? This allows them to view the troop calendar, receive updates, and sign up as Registered Adults.
Why add family members? Adding a father, grandfather, or other male family member allows them to become a Registered Adult through Trail Life, which is required to participate in campouts, certain events, and to hold leadership positions in the troop.
+ Add a Family MemberAfter a successful submit, the form shows a green checkmark and one of three messages depending on the parent role.
Family with trailmen (default)
You're Signed Up!
Your family has been registered with Troop TX-0139. Log in now to view your sign-up checklist and complete the remaining registration steps.
Log In & View ChecklistButton links to login.html?redirect=/dashboard/checklist.html.
Male Volunteer
You're Signed Up!
Thanks for signing up to volunteer with Troop TX-0139. We'll review your account and reach out shortly with next steps for becoming a Registered Adult.
Got itButton links to /index.html.
Friend of the Troop
You're Signed Up!
Thanks for signing up to support Troop TX-0139. We'll review your account and get back to you shortly. Once approved, you'll be able to log in to make donations and view your contribution history.
Got itButton links to /index.html.
invites/{emailId} doc is created with status: 'pending', source: 'signup', and a signupData object holding parentRole, parentLeaderInterest, parentNotificationPref ('both' / 'text' / 'email' / 'none'), boys, and familyMembers. The doc id is the lower-cased email with non-alphanumeric chars replaced by underscores.
signupNotify fires (fire-and-forget). It sends an admin notification email — see "Admin sign-up notification" below.
users/{uid} record.
Admin Sends an Invite
Admin opens /dashboard/admin-invites.html, fills the "Invite a Member" card. The system creates an invite doc and (best-effort) sends a Twilio SMS with a sign-in link.
Invite a Member
The system calls sendInviteSms Cloud Function, which uses Twilio. If Twilio fails, admin sees a "Send Text Manually" button that opens the device SMS app pre-filled with the same body.
invites/{emailId} doc with status: 'pending', name, email, phone (10-digit), role, invitedAt. Optional familyId. No signupData — that field only exists when the public sign-up form is the source.
User Logs In for the First Time
Reached after Paths 1 or 2. The login page defaults to Phone sign-in with an email toggle. After auth, a 4-way decision tree determines what the user sees next.
Troop TX-0139 — Login
Enter your phone number to receive a verification code.
Or sign in with email
Enter the 6-digit code sent to (555) 123-4567.
Use a different number
Having trouble? Sign in with email instead
Enter your email and we'll send a sign-in link — no password needed.
Or sign in with phone
✉
Check your inbox! We sent a sign-in link to you@example.com. Click the link in the email to continue.
Use a different email
After clicking the email link, the user lands back on /login with auth params; they briefly see the Signing you in… spinner while signInWithEmailLink runs.
In login.js's onAuthStateChanged handler, the system runs four checks in order:
users/{uid} by Firebase UID. If it exists → redirect to getRedirect() (defaults to /dashboard/).
findExistingProfile() queries users by phone (10-digit, +1-prefixed, and full E.164 forms) then by email. If found, copy that doc to the new UID, migrate family_members records (both selfUid and userId matches), delete the old users/{oldUid}, redirect to dashboard. (This is the bridge for Convert-to-User and Add-User-Directly paths.)
findInvite() queries invites by phone (10-digit) then email. If found, pre-fill the Profile Completion form (3a below) and switch to it.
Pre-filled with invite data + Firebase Auth data. profileEmail is set readOnly if the user signed in via email; profilePhone is set readOnly if they signed in via phone.
Almost there! Complete your profile to continue.
users/{uid} with name, email, phone (10-digit), role (from invite or 'leader' fallback), familyId (from invite, or user.uid), and notificationPref if the invite had one. Updates the invite to status: 'accepted', uid: user.uid, acceptedAt: serverTimestamp(). If the invite came from public sign-up (has signupData), creates one self family_members record (parent role) plus one record per boy and one per additional familyMember; for each non-trailman family member with email, creates a downstream pending invite as well.
🔒
Sorry, this login is for invited members only. If you believe this is an error, please contact your Troopmaster.
Back to SiteButton links to /index.html. The Firebase Auth account stays — they're only signed out of the site session.
/dashboard/ with a working profile. They have a users/{uid} doc, family_members records (where applicable), and an accepted invite.
Admin Converts a Pending Invite
Admin pre-creates everything (users + family_members) before the user logs in. When they eventually sign in, login.js's Check B seamlessly attaches their Firebase UID. They never see "Complete Profile."
Available by clicking any pending-invite row on /dashboard/admin-people.html (preferred) or via the per-row Convert to User button on /dashboard/admin-invites.html.
Pending Invite
[Invite name]
[email] · [phone (formatted)]
Role: user · Status: pending · Source: Public sign-up form (when source: 'signup') / Admin invite (when source field absent) / raw value otherwise (e.g., signup-family for invites auto-created during a parent's profile completion)
Trailmen on signup: Aiden — 2nd grade · Caleb — Kindergarten
Other family members on signup: Sarah — mother
Close Resend Text Revoke Login Remove Invite Convert to UserResend Text only appears when the invite has a phone. Revoke Login only appears when it has an email. Trailmen + other-family-members lists only appear when the invite came from the public sign-up form.
Browser confirm() dialog: "Convert this pending invite into a registered user? This pre-creates their profile + family records so you can manage them on their behalf. When they eventually log in, their data will automatically attach to their real account."
Other modal buttons have their own confirm dialogs:
- Revoke Login: "Revoke this person's Firebase login AND delete the invite? They will not be able to log in again unless re-invited."
- Remove Invite: "Permanently delete this invite? This cannot be undone — they will have no record in the system at all. (Use this only for typos / invalid invites; for everything else, use Convert to User or Revoke Login.)"
- Resend Text: no confirm dialog — fires immediately and shows "Sent ✓" briefly on success.
A placeholder UID like pre_<random> is generated. No SMS or email is sent as part of the conversion.
users/pre_xyzwithprefilledByAdmin: true- One self
family_membersrecord with the parent role +isSelf: true+selfUid: 'pre_xyz' - One
family_membersrecord perboyfromsignupData, withrole: 'trailman'+ grade / school / birthday / signupStatus 'pending' - One
family_membersrecord per other family member fromsignupData - The invite is updated to
status: 'accepted',uid: 'pre_xyz',acceptedBy: 'admin-prefill'
source: 'signup-family') for each additional family member that has an email — so they can log in too. Path 4 (admin Convert) skips that step. Secondary family members on a converted invite stay as family_members rows only — they need a separate invite (Path 2) before they can log in.
When the user verifies their email or phone, login.js's Check B finds users/pre_xyz by email/phone match, copies the data to the real Firebase UID, migrates the family_members records (rewriting selfUid and userId), and deletes the placeholder. They go straight to /dashboard/ with no Profile Completion screen.
Admin Adds a User Directly
Skip the invite step entirely. /dashboard/admin-members.html → + Add User Directly. Same pre-fill mechanism as Path 4, just without an invite ever existing.
Button is in the page header next to the Members title.
Add User Directly
Skips the invite step. Creates the user record + a "self" family-member record. When this person eventually verifies their email or phone, the system attaches everything to their real Firebase Auth account automatically.
users/pre_xyz with prefilledByAdmin: true, plus one self family_members record with the chosen family role + the contact info + isSelf: true. No invite, no email, no SMS.
Trailmen and other family members are not created here. To add them, go to /dashboard/admin-families.html and use + Add Member on that family's row.
All Emails & Texts the System Sends
Verbatim copy of every notification that goes to a user or admin during the sign-up + login flows.
Sent by Cloud Function signupNotify when anyone completes the public sign-up form. Fire-and-forget from the client.
New Troop Sign Up!
A formatted HTML table with: Name · Email · Phone · Relationship (parent role) · Leader Interest (if checked) · per-trailman block (Name · Birthday · Grade · School) · per-family-member block (Name · Role · Email · Phone · Leader Interest if checked).
Fired by Cloud Function sendInviteSms via Twilio when an admin clicks Send Invite on admin-invites.html. Also fired from the People-page invite modal's Resend Text button.
Fired by Cloud Function sendFamilyWelcomeSms. Three trigger points:
(1) when a user adds a non-trailman family member with email on their own /dashboard/family.html;
(2) when an admin clicks + Add Member on a family in /dashboard/admin-families.html;
(3) when an admin clicks the per-row + Family Member button in /dashboard/admin-members.html.
For (2) and (3) the admin modal has a "Send a welcome text inviting them to log in" checkbox (default checked) — uncheck it to skip the SMS.
Sent by Firebase Authentication when the user clicks Send Sign-In Link. The codebase does not override Firebase's default email template — verbatim content as observed:
Hello,
We received a request to sign in to grace-trail-life using this email address, at [YYYY MMM DD HH:MM] UTC. If you want to sign in with your [user's email] account, click this link:
Sign in to grace-trail-life
If you did not request this link, you can safely ignore this email.
Thanks,
Your grace-trail-life team
"grace-trail-life" throughout is the Firebase project ID. The link routes through https://grace-trail-life.firebaseapp.com/__/auth/action?... (Firebase's auth handler), then bounces back to actionCodeSettings.url from login.js (which is window.location.origin + '/login' — i.e., the same domain the user started on). To customize the subject/body, edit the template in Firebase Console → Authentication → Templates → Email link.
Sent by Firebase Authentication when the user clicks Send Verification Code. The 6-digit code SMS is generated and sent by Firebase / Google's SMS provider — not Twilio, not customizable. Verbatim text as observed:
"gracetraillife.org" is Firebase's app display name (configurable in Firebase Console → Project Settings). The 6-digit code rotates each request.
When sendInviteSms or sendFamilyWelcomeSms errors (Twilio failure, network), the page surfaces a "Send Text Manually to [Name]" button. It opens an sms: link with the same body pre-filled, so the admin can send from their own device.
At a glance
| Path | Trigger | Creates invite? | Creates user? | SMS/Email sent? | "Complete Profile" form? |
|---|---|---|---|---|---|
| 1 · Public sign-up | Family fills /signup | ✅ pending (with signupData) | — | Admin notify email only | ✅ on first login |
| 2 · Admin invite | Admin form on admin-invites | ✅ pending (no signupData) | — | Twilio SMS to user | ✅ on first login |
| 3 · User login | User opens /login | — | ✅ at end of flow | Auth code only (Firebase) | Depends on prior path |
| 4 · Admin convert | Click invite row → modal | Marks accepted | ✅ pre-filled (pre_*) | — | ❌ skipped |
| 5 · Admin direct | + Add User Directly | — | ✅ pre-filled (pre_*) | — | ❌ skipped |