← Admin Tools

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

  1. Public Sign-Up Form — family fills out signup.html on their own
  2. Admin sends an Invite — admin uses admin-invites.html
  3. User Logs In for the First Time — applies to paths 1 + 2
  4. Admin Converts a Pending Invite
  5. Admin Adds a User Directly

Outbound notifications

  1. All emails & texts the system sends — verbatim copy
Path 1 · Public

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".

1 Step 1 — Parent / Guardian Information

Always shown. The role select uses two optgroups, "Family of a Trailman" and "No Trailman." Selecting a male role reveals the leader-interest checkbox.

User sees

Parent / Guardian Information

Tell us about yourself so we can set up your family account.

Full NameYour full name
Email Addressyou@example.com
Phone Number(555) 123-4567
I'm signing up as… ▾ Family of a Trailman: Father · Mother · Grandfather · Grandmother · Other Male Family · Other Female Family
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.

Next
Branch — duplicate-account check. When the user clicks Next, the form calls Cloud Function checkSignupContact 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.
Branch — no-trailman roles. If role is maleVolunteer or friend, the form skips Steps 2 and 3 entirely and calls submitSignup([], []) immediately on clicking Next.
2 Step 2 — Trailman Information

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.

User sees

Trailman Information

Tell us about the boy(s) you'd like to sign up. You can add more than one.

Trailman 1

First NameFirst name
Last NameLast name
Date of Birthmm/dd/yyyy
Grade for the upcoming school yearPre-K4 / Kindergarten / 1st grade / … / 12th grade ▾
School for the upcoming school yearSchool name
+ Add Another Trailman
Back Next

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.

3 Step 3 — Additional Family Members (optional)

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.").

User sees

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 Member
Back Submit Sign Up
4 Success page (3 variants)

After 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 Checklist

Button 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 it

Button 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 it

Button links to /index.html.

Firestore writes: A single 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.
Outbound: Cloud Function signupNotify fires (fire-and-forget). It sends an admin notification email — see "Admin sign-up notification" below.
Outcome: A pending invite exists. The family cannot log in yet — they have to use the email/phone they signed up with on /login.html (Path 3) before the system creates a real users/{uid} record.
Path 2 · Admin

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.

1 Admin fills "Invite a Member"
Admin sees

Invite a Member

NameFull name
Emailyou@example.com
Phone(555) 123-4567
RoleUser / Leader / Admin ▾
Add to Family (optional)None / existing family ▾
Send Invite
2 User receives invite text

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.

Text on user's phone
From: Trail Life Twilio number
Hi [Name]! You've been invited to the Grace Trail Life Troop TX-0139 portal. Sign in here: https://gracetraillife.org/login
Firestore writes: One 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.
Outcome: Same end state as Path 1. The user clicks the link → /login → Path 3 takes over.
Path 3 · User

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.

1a Default — Phone Sign-In
User sees

Troop TX-0139 — Login

Enter your phone number to receive a verification code.

Phone Number(555) 123-4567
Send Verification Code

Or sign in with email

1a.2 Phone — Verification Code
User sees

Enter the 6-digit code sent to (555) 123-4567.

Verification Code123456
Verify & Sign In

Use a different number

Having trouble? Sign in with email instead

1b Alt — Email Magic Link
User sees

Enter your email and we'll send a sign-in link — no password needed.

Email Addressyou@example.com
Send Sign-In Link

Or sign in with phone

1b.2 Email — "Check your inbox" confirmation
User sees (after clicking Send Sign-In Link)

✉

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.

2 Auth completes — 4-way decision tree

In login.js's onAuthStateChanged handler, the system runs four checks in order:

Check A — Already a registered user? Look up users/{uid} by Firebase UID. If it exists → redirect to getRedirect() (defaults to /dashboard/).
Check B — Profile under a different UID? 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.)
Check C — Pending invite? findInvite() queries invites by phone (10-digit) then email. If found, pre-fill the Profile Completion form (3a below) and switch to it.
Check D — None of the above? Sign the user out and show the "Not Invited" screen (3b below). The Firebase Auth user record is left intact (so they don't have to re-verify if re-invited later).
3a Profile Completion (when Check C matches)

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.

User sees

Almost there! Complete your profile to continue.

Full NamePre-filled from invite
Email AddressPre-filled — read-only if signed in via email
Phone NumberPre-filled — read-only if signed in via phone
Complete Profile
On submit: creates 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.
3b Not Invited screen (when Check D matches)
User sees

🔒

Sorry, this login is for invited members only. If you believe this is an error, please contact your Troopmaster.

Back to Site

Button links to /index.html. The Firebase Auth account stays — they're only signed out of the site session.

Outcome: User lands on /dashboard/ with a working profile. They have a users/{uid} doc, family_members records (where applicable), and an accepted invite.
Path 4 · Admin

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."

1 Admin opens the invite-edit modal

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.

Admin sees (Pending Invite modal)

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 User

Resend 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.

2 Admin clicks Convert to User → confirm dialog

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.
3 System pre-creates all records

A placeholder UID like pre_<random> is generated. No SMS or email is sent as part of the conversion.

Firestore writes:
  • users/pre_xyz with prefilledByAdmin: true
  • One self family_members record with the parent role + isSelf: true + selfUid: 'pre_xyz'
  • One family_members record per boy from signupData, with role: 'trailman' + grade / school / birthday / signupStatus 'pending'
  • One family_members record per other family member from signupData
  • The invite is updated to status: 'accepted', uid: 'pre_xyz', acceptedBy: 'admin-prefill'
Differs from Path 3a: when a user completes their own Profile (Path 3a), the system also creates a downstream pending invite (with 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.
4 User logs in later — seamless attach

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.

Outcome: Identical end state to Path 3, but the Profile Completion form is skipped. Useful when admin wants to manage a family's records (add trailmen, mark dues paid, etc.) before the family logs in.
Path 5 · Admin

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.

1 Admin clicks "+ Add User Directly"

Button is in the page header next to the Members title.

2 Admin fills the modal
Admin sees

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.

First Name *
Last Name *
Email *email@example.com
Phone *(555) 123-4567
App Role *User / Leader / Admin ▾
Family Role *Father / Mother / Grandfather / Grandmother / Other Male Family / Other Female Family / Male Volunteer (no trailmen) / Friend of the Troop ▾
FamilyNew family (this user is the head) / [existing families…] ▾
Cancel Create User
3 System creates user + self record
Firestore writes: 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.

4 User logs in eventually — same seamless attach as Path 4
Outcome: Same as Path 4. Useful for one-off cases where you want to set the family up without sending an invite text/email.
Outbound

All Emails & Texts the System Sends

Verbatim copy of every notification that goes to a user or admin during the sign-up + login flows.

📧 Admin sign-up notification

Sent by Cloud Function signupNotify when anyone completes the public sign-up form. Fire-and-forget from the client.

From: "Trail Life TX-0139" <info@gracetraillife.org> (sender Gmail account)
To: brett.bennett@me.com (hardcoded recipient)
Reply-To: [the parent's email]
Subject: New Sign Up: [Parent Name] (N trailman / trailmen)

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).

📱 Invite SMS — admin-sent invite

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.

From: Trail Life Twilio number → User's phone
Hi [Name]! You've been invited to the Grace Trail Life Troop TX-0139 portal. Sign in here: https://gracetraillife.org/login
📱 Family Welcome SMS

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.

From: Trail Life Twilio number → New member's phone
Hi [First Name]! You've been added to the Grace Trail Life Troop TX-0139 family portal. Sign in here: https://gracetraillife.org/login
📧 Email Magic Link (Firebase Auth)

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:

From: noreply@grace-trail-life.firebaseapp.com
To: [User's email]
Subject: Sign in to grace-trail-life requested at [YYYY MMM DD HH:MM] UTC

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.

📱 Phone OTP (Firebase Auth via Google)

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:

From: shortcode → User's phone
[6-digit code] is your verification code for gracetraillife.org

"gracetraillife.org" is Firebase's app display name (configurable in Firebase Console → Project Settings). The 6-digit code rotates each request.

📲 Manual SMS fallback (admin-side only)

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.

Comparison

At a glance

PathTriggerCreates invite?Creates user?SMS/Email sent?"Complete Profile" form?
1 · Public sign-upFamily fills /signup✅ pending (with signupData)—Admin notify email only✅ on first login
2 · Admin inviteAdmin form on admin-invites✅ pending (no signupData)—Twilio SMS to user✅ on first login
3 · User loginUser opens /login—✅ at end of flowAuth code only (Firebase)Depends on prior path
4 · Admin convertClick invite row → modalMarks accepted✅ pre-filled (pre_*)—❌ skipped
5 · Admin direct+ Add User Directly—✅ pre-filled (pre_*)—❌ skipped