feat: create an account in the iPhone app by gnapse · Pull Request #148 · klipstack/klipstack · GitHub
Skip to content

feat: create an account in the iPhone app - #148

Merged
gnapse merged 3 commits into
mainfrom
app-sign-up
Oct 20, 2026
Merged

gnapse merged 3 commits into
mainfrom
app-sign-up

Conversation

@gnapse

@gnapse gnapse commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Why

The iPhone app could only sign in: a new reader had to create an account on the web first. This adds sign-up in the app, with the same invite rules as the web.

What changes

  • "New to Klipstack? Create an account" under the app's sign-in opens a sign-up screen.
    • The invite code comes first. The field is hidden when sign-up is open; a waitlist server shows a "Request one" link to its request page.
    • Then Apple, Google or GitHub, or name, email and password.
  • Email sign-up sends a 6-digit code. The account is created only when the code checks out, already verified.
    • The code is hashed, allows 3 tries and lasts 10 minutes, and works only for its own address.
    • An address that already has an account gets an email telling it to sign in, and the app gets the same answer.
  • An invite is used only when an account is created. An Apple ID that already has an account just signs in, whatever the invite.
  • A sign-up refused for lack of a usable invite revokes the Apple authorization it just made.
  • The sign-in still never creates accounts. Only /app/sign-up and the provider sheet started with sign_up=1 can, through the same user-create hook as the web.
  • A new account takes the phone's language, sent as Accept-Language.
  • Limits: 10 sign-up codes a day per address (100 per IP), and 10 sign-ups per address and 20 per IP an hour, as on the web.
  • The code field now spaces only the digits typed, not its placeholder.

Verification

  • In the simulator against the dev server: invite → name, email and password → code → Home. The database showed the account verified, with its password, the invite used and the app's consent.
  • New tests cover email, Apple and GitHub sign-up, wrong and cross-address codes, the try limit, bad invites, existing accounts and Spanish. Breaking each key rule makes a test fail.
  • pnpm verify and pnpm ci:local (static, unit, build) pass. In e2e, 304 passed. "Getting started card" failed all retries under load, as it flaked before; run alone it passed 3 of 3. It is unrelated to sign-up.
  • Two fresh reviews ran. Fixed from them:
    • An Apple user with an account, coming through sign-up with a used invite, was refused and revoked.
    • The app's sign-up was looser per IP than the web's.
    • No test covered a code being used for another address.
  • Dismissed from the reviews:
    • A code is used up when two sign-ups race for one invite. The loser asks for a new one.
    • An invite used up mid-sheet comes back as "no account".
  • Not verified: real Apple, Google and GitHub sign-ups (they need TestFlight), and whether iOS reports Spanish to this English-only app for the account's language.

Risk and follow-ups

  • New security row in docs/security.md: "The app's sign-up".
  • The mobile app ships through TestFlight after this deploys.

gnapse and others added 3 commits October 20, 2026 16:32
…ogle and GitHub, with an invite

/app/sign-up/code checks the invite and emails a code; /app/sign-up creates
the account, verified, once the code checks out, or with Apple's sheet; the
provider sheet takes sign_up=1 and the invite. The invite is consumed only
when a user is created.

Amp-Thread-ID: https://ampcode.com/threads/T-01a15729-a41b-749a-be6e-639752903e39
Co-authored-by: Amp <amp@ampcode.com>
A sign-up screen behind "Create an account": the invite, then Apple,
Google or GitHub, or a name, email and password confirmed by an emailed
code. The code field spaces its digits, not its placeholder.

Amp-Thread-ID: https://ampcode.com/threads/T-01a15729-a41b-749a-be6e-639752903e39
Co-authored-by: Amp <amp@ampcode.com>
…and the sign-up's limit matches the web's

From the review: a used-up invite no longer refuses, and revokes, an Apple ID
that has an account; a code works only for its own address (tested).
@gnapse
gnapse enabled auto-merge (squash) October 20, 2026 20:05
@gnapse
gnapse merged commit c76f90a into main Oct 20, 2026
10 checks passed
@gnapse
gnapse deleted the app-sign-up branch October 20, 2026 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant