Add APP_EMAIL_ALLOWLIST gate on account creation
Build / build-and-push (push) Successful in 14s

An optional comma-separated list of glob patterns restricting which
addresses may register, applied on top of APP_ALLOW_REGISTRATION. A
non-matching new address is silently ignored exactly like registration
being off; an address that already has an account can still sign in.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-06 21:26:33 +01:00
co-authored by Claude Sonnet 5
parent 06d5b721a3
commit 8732e0e5f5
9 changed files with 120 additions and 7 deletions
+4
View File
@@ -17,6 +17,8 @@ final class Config
public readonly bool $displayErrors,
/** When false, POST /auth/magic-link only signs existing users in -- it never creates a new account. */
public readonly bool $allowRegistration,
/** Optional glob-pattern gate on which addresses may create an account. Empty => no restriction. */
public readonly EmailAllowlist $emailAllowlist,
/** Base URL of the frontend, used to build magic links. */
public readonly string $appUrl,
/** WebAuthn relying party ID -- the domain a passkey is bound to. */
@@ -51,6 +53,7 @@ final class Config
$jwtTtl = (int) (self::env('JWT_TTL') ?? '86400');
$displayErrors = filter_var(self::env('APP_DEBUG', 'false'), FILTER_VALIDATE_BOOL);
$allowRegistration = filter_var(self::env('APP_ALLOW_REGISTRATION', 'true'), FILTER_VALIDATE_BOOL);
$emailAllowlist = EmailAllowlist::fromString(self::env('APP_EMAIL_ALLOWLIST'));
$appUrl = rtrim(self::env('APP_URL', 'http://localhost:5173'), '/');
@@ -86,6 +89,7 @@ final class Config
$jwtTtl,
$displayErrors,
$allowRegistration,
$emailAllowlist,
$appUrl,
$webauthnRpId,
$webauthnRpName,