invites: an admin lets one person register while registration stays closed
CI & Build / Python lint (push) Successful in 2s
CI & Build / Build now, or wait for Android? (push) Successful in 2s
Android / Build, or is the channel already serving this? (push) Successful in 2s
Android / Kotlin + Rust (APK) (push) Skipped
Desktop (Tauri) / Build, or is the channel already serving this? (push) Successful in 3s
CI & Build / Web typecheck and unit tests (push) Successful in 8s
CI & Build / Python tests (push) Successful in 11s
CI & Build / integration (push) Successful in 47s
CI & Build / Build & push image (push) Successful in 54s
Desktop (Tauri) / Web tests, clippy, Rust tests and rustfmt (push) Successful in 2m8s
Desktop (Tauri) / Windows installer (cross-compiled) (push) Successful in 2m28s
Desktop (Tauri) / Tauri desktop (Linux) (push) Successful in 3m14s
Desktop (Tauri) / Update manifest (push) Successful in 4s
CI & Build / Python lint (push) Successful in 2s
CI & Build / Build now, or wait for Android? (push) Successful in 2s
Android / Build, or is the channel already serving this? (push) Successful in 2s
Android / Kotlin + Rust (APK) (push) Skipped
Desktop (Tauri) / Build, or is the channel already serving this? (push) Successful in 3s
CI & Build / Web typecheck and unit tests (push) Successful in 8s
CI & Build / Python tests (push) Successful in 11s
CI & Build / integration (push) Successful in 47s
CI & Build / Build & push image (push) Successful in 54s
Desktop (Tauri) / Web tests, clippy, Rust tests and rustfmt (push) Successful in 2m8s
Desktop (Tauri) / Windows installer (cross-compiled) (push) Successful in 2m28s
Desktop (Tauri) / Tauri desktop (Linux) (push) Successful in 3m14s
Desktop (Tauri) / Update manifest (push) Successful in 4s
Until now adding a second person meant re-opening registration to the whole internet while they signed up (#2939 §1). An admin now makes an invite in Settings: a link that works once, expires (7 days by default, 1 to 30), and can be pinned to one email address. Only the token's hash is stored, so the link is shown once. POST /api/auth/register takes `invite`. Redemption is one conditional UPDATE inside the transaction that creates the account, so two people racing one link can't both get in, and a taken email leaves the invite unused. Every refusal says "invalid or expired invite". The register page reads ?invite= and opens even while registration is closed. Refs #5172 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -66,7 +66,9 @@ export interface ConfigRepo {
|
||||
export interface AuthRepo {
|
||||
me(): Promise<User>;
|
||||
login(email: string, password: string): Promise<User>;
|
||||
register(email: string, password: string, displayName: string): Promise<User>;
|
||||
/** `invite` is the token from an invite link, which lets this one account in
|
||||
* while registration is closed. */
|
||||
register(email: string, password: string, displayName: string, invite?: string): Promise<User>;
|
||||
logout(): Promise<void>;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,8 +53,8 @@ export const rest: Repo = {
|
||||
auth: {
|
||||
me: () => api.get<User>("/api/auth/me"),
|
||||
login: (email, password) => api.post<User>("/api/auth/login", { email, password }),
|
||||
register: (email, password, displayName) =>
|
||||
api.post<User>("/api/auth/register", { email, password, display_name: displayName }),
|
||||
register: (email, password, displayName, invite) =>
|
||||
api.post<User>("/api/auth/register", { email, password, display_name: displayName, invite }),
|
||||
logout: () => api.post<void>("/api/auth/logout"),
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user