# Profile accounts People can have an account on the site for their own profile (migration 076). Nobody signs up: an admin invites them. ## How it goes 1. **Invite.** Data → Profile accounts → Invite someone (admins and up): an email, and a name if you like. That makes a *member* account with no password, and shows its invite link once, for 14 days. Copy it to send yourself, or press Email invite to send a fresh one through Gmail (needs Gmail set up, `docs/google-drive-and-mail.md`; the link shown before stops working). 2. **Sign up.** The link opens `/account/welcome`: they set a password, or continue with Google under the invited email (any Google account, not only @nextgenerationofunity.org, when Google sign-in is on, `docs/google-sign-in.md`). Either takes up the invite. 3. **Claim.** On `/account` (Your profile, also the footer's Sign in link) they pick the People record that's them and send the request. It waits under Claims on Data → Profile accounts until an admin approves or declines it. An admin can also set an account's record directly there. 4. **Edit.** With a record, they edit its pronouns, tagline, location, public email and phone, bio and photo, and tick what to hide on the site. Their name, publishing and everything else stay the admin's. Changes are live as soon as they save. A member is below viewer: signed in to the site, never to the admin (`/api/admin` refuses anything under viewer, `requireStaff` in `server/src/auth.js`). Staff accounts can claim a record too, from `/account`. Forgotten password: on the account's row, New sign-in link (or Email a sign-in link); opening it sets a new password. Turn off stops an account signing in and ends its sessions. Remove deletes the account; its People record stays. ## What "hidden" does Each hidden part (photo, pronouns, tagline, bio, public email, public phone, location, links) stays in the record, and the admin's People editor shows the same switches (Hidden on the site). The site never shows it: every public read goes through the `v_people_public` view, which nulls hidden fields, and person links are left out when links are hidden (`loadLinks` in `server/src/shape.js`). When adding a public query on people, read `v_people_public`, not `people`. ## Discord A profile can link its Discord account (the `identify` scope only: the Discord user id and name), kept for the gamification to come. Off until the service has a Discord application: 1. https://discord.com/developers/applications → New Application. 2. OAuth2 → Redirects: add `https://nextgenerationofunity.org/api/account/discord/callback` (and the dev server's address, if you test there). 3. Copy the Client ID and Client Secret into the service's environment (`systemctl edit ngu-api`): ``` [Service] Environment=DISCORD_CLIENT_ID=... Environment=DISCORD_CLIENT_SECRET=... ``` `DISCORD_REDIRECT_URI` overrides the return address (default: site.json's `url` plus `/api/account/discord/callback`). 4. `systemctl restart ngu-api`. An admin can set or clear an account's Discord id by hand on its row (the long number from Discord: Developer Mode, then Copy User ID). Code: `server/src/invites.js`, `server/src/discordAuth.js`, `server/src/routes/account.js` (the member's own routes), `server/src/routes/profiles.js` (the admin's), `src/pages/Account.tsx`, `src/pages/AccountWelcome.tsx`, `src/pages/SignIn.tsx`, `src/pages/admin/AdminProfiles.tsx`.