@softure-ai/auth 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +130 -21
  3. package/dist/contract.d.ts +3 -1
  4. package/dist/contract.d.ts.map +1 -1
  5. package/dist/contract.js.map +1 -1
  6. package/dist/index.d.ts +6 -0
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +2 -2
  9. package/dist/index.js.map +1 -1
  10. package/dist/messages/en.d.ts +1 -0
  11. package/dist/messages/en.d.ts.map +1 -1
  12. package/dist/messages/en.js +1 -0
  13. package/dist/messages/en.js.map +1 -1
  14. package/dist/messages/index.d.ts +2 -0
  15. package/dist/messages/index.d.ts.map +1 -1
  16. package/dist/messages/pl.d.ts.map +1 -1
  17. package/dist/messages/pl.js +1 -0
  18. package/dist/messages/pl.js.map +1 -1
  19. package/dist/next/actions.d.ts +1 -1
  20. package/dist/next/actions.d.ts.map +1 -1
  21. package/dist/next/actions.js +37 -16
  22. package/dist/next/actions.js.map +1 -1
  23. package/dist/next/context.js +2 -2
  24. package/dist/next/context.js.map +1 -1
  25. package/dist/next/index.d.ts +1 -1
  26. package/dist/next/index.d.ts.map +1 -1
  27. package/dist/next/index.js +1 -1
  28. package/dist/next/index.js.map +1 -1
  29. package/dist/next/pages.d.ts +13 -0
  30. package/dist/next/pages.d.ts.map +1 -1
  31. package/dist/next/pages.js +28 -2
  32. package/dist/next/pages.js.map +1 -1
  33. package/dist/next/session-cookie.d.ts +3 -0
  34. package/dist/next/session-cookie.d.ts.map +1 -1
  35. package/dist/next/session-cookie.js +39 -2
  36. package/dist/next/session-cookie.js.map +1 -1
  37. package/dist/options.d.ts +10 -1
  38. package/dist/options.d.ts.map +1 -1
  39. package/dist/options.js +44 -3
  40. package/dist/options.js.map +1 -1
  41. package/dist/proxy/index.d.ts +5 -0
  42. package/dist/proxy/index.d.ts.map +1 -1
  43. package/dist/proxy/index.js +25 -7
  44. package/dist/proxy/index.js.map +1 -1
  45. package/dist/safe-next-path.d.ts +3 -1
  46. package/dist/safe-next-path.d.ts.map +1 -1
  47. package/dist/safe-next-path.js +9 -3
  48. package/dist/safe-next-path.js.map +1 -1
  49. package/dist/scripts/index.d.ts +1 -0
  50. package/dist/scripts/index.d.ts.map +1 -1
  51. package/dist/scripts/index.js +3 -1
  52. package/dist/scripts/index.js.map +1 -1
  53. package/dist/scripts/temporary-password.d.ts +12 -0
  54. package/dist/scripts/temporary-password.d.ts.map +1 -0
  55. package/dist/scripts/temporary-password.js +47 -0
  56. package/dist/scripts/temporary-password.js.map +1 -0
  57. package/dist/server/change-password.d.ts +1 -1
  58. package/dist/server/change-password.d.ts.map +1 -1
  59. package/dist/server/change-password.js +4 -1
  60. package/dist/server/change-password.js.map +1 -1
  61. package/dist/server/index.d.ts +2 -2
  62. package/dist/server/index.d.ts.map +1 -1
  63. package/dist/server/index.js +2 -2
  64. package/dist/server/index.js.map +1 -1
  65. package/dist/server/login.js +5 -4
  66. package/dist/server/login.js.map +1 -1
  67. package/dist/server/options.d.ts +2 -0
  68. package/dist/server/options.d.ts.map +1 -1
  69. package/dist/server/options.js +14 -0
  70. package/dist/server/options.js.map +1 -1
  71. package/dist/server/password.d.ts +10 -3
  72. package/dist/server/password.d.ts.map +1 -1
  73. package/dist/server/password.js +24 -8
  74. package/dist/server/password.js.map +1 -1
  75. package/dist/server/rate-limits.d.ts +3 -2
  76. package/dist/server/rate-limits.d.ts.map +1 -1
  77. package/dist/server/rate-limits.js +9 -3
  78. package/dist/server/rate-limits.js.map +1 -1
  79. package/dist/server/register.d.ts +2 -0
  80. package/dist/server/register.d.ts.map +1 -1
  81. package/dist/server/register.js +13 -1
  82. package/dist/server/register.js.map +1 -1
  83. package/dist/server/session-token.d.ts +6 -2
  84. package/dist/server/session-token.d.ts.map +1 -1
  85. package/dist/server/session-token.js +7 -3
  86. package/dist/server/session-token.js.map +1 -1
  87. package/dist/server/sessions.d.ts +9 -0
  88. package/dist/server/sessions.d.ts.map +1 -1
  89. package/dist/server/sessions.js +13 -4
  90. package/dist/server/sessions.js.map +1 -1
  91. package/dist/testing/account.d.ts +17 -0
  92. package/dist/testing/account.d.ts.map +1 -0
  93. package/dist/testing/account.js +31 -0
  94. package/dist/testing/account.js.map +1 -0
  95. package/dist/testing/index.d.ts +2 -0
  96. package/dist/testing/index.d.ts.map +1 -0
  97. package/dist/testing/index.js +4 -0
  98. package/dist/testing/index.js.map +1 -0
  99. package/dist/ui/auth-forms.d.ts +14 -7
  100. package/dist/ui/auth-forms.d.ts.map +1 -1
  101. package/dist/ui/auth-forms.js +14 -12
  102. package/dist/ui/auth-forms.js.map +1 -1
  103. package/module.json +2 -2
  104. package/package.json +15 -3
  105. package/src/contract.ts +3 -0
  106. package/src/index.ts +2 -2
  107. package/src/messages/en.ts +1 -0
  108. package/src/messages/pl.ts +1 -0
  109. package/src/next/actions.ts +38 -14
  110. package/src/next/context.ts +2 -2
  111. package/src/next/index.ts +10 -1
  112. package/src/next/pages.tsx +44 -0
  113. package/src/next/session-cookie.ts +42 -2
  114. package/src/options.ts +49 -3
  115. package/src/proxy/index.ts +35 -8
  116. package/src/safe-next-path.ts +9 -3
  117. package/src/scripts/index.ts +7 -1
  118. package/src/scripts/temporary-password.ts +62 -0
  119. package/src/server/change-password.ts +4 -1
  120. package/src/server/index.ts +10 -2
  121. package/src/server/login.ts +5 -5
  122. package/src/server/options.ts +15 -0
  123. package/src/server/password.ts +26 -8
  124. package/src/server/rate-limits.ts +10 -3
  125. package/src/server/register.ts +16 -1
  126. package/src/server/session-token.ts +7 -3
  127. package/src/server/sessions.ts +19 -4
  128. package/src/testing/account.ts +43 -0
  129. package/src/testing/index.ts +3 -0
  130. package/src/ui/auth-forms.tsx +26 -7
package/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ Newest first. Each version lists what changed for an app that uses `@softure-ai/auth`. When an app has run a version in
4
+ production, the version gets a line `verified in: <app>@<commit>` ([docs/05](../../docs/05-adoption-playbook.md),
5
+ "Definition of done"). Versions before the first one below are described in their GitHub Releases (`auth@x.y.z`).
6
+
7
+ ## 0.1.7
8
+
9
+ - `module.json` names `mailing` and `ops` as optional dependencies.
10
+ - Adapters and commands use the configured database handle; `@softure-ai/ui` is a peer dependency.
11
+ - Deny-by-default route guard and the legacy session cookie name.
12
+ - Registration fields, a register page factory, a submit variant and longer `next` paths.
13
+ - Legacy password hashes normalised to NFC, an unchanged new password refused, conditional reset buckets, session revocation.
14
+ - `set-temporary-password` ops script; `@softure-ai/ops` is an optional peer.
15
+ - `createTestAccount` in `@softure-ai/auth/testing`.
package/README.md CHANGED
@@ -2,31 +2,33 @@
2
2
 
3
3
  Accounts for a Next.js app: register with a required consent, login, logout, password change,
4
4
  password reset by an emailed link, roles with admin-only surfaces that fail closed, database sessions, a route guard for `proxy.ts`, and ready pages and forms. The reference module
5
- of the SOFTURE standard (docs/02): it has every layer, from migrations to messages. Built from
6
- FIRE_TRACKER's auth (`src/lib/{password,session}.ts`, `src/db/sessions.ts`,
7
- `src/app/actions/do-auth.ts`, `src/proxy.ts`), with the rate limiter of `@softure-ai/security`
8
- and the route guard separated from channel tagging.
5
+ of the SOFTURE standard (docs/02): it has every layer, from migrations to messages. It counts
6
+ attempts with the rate limiter of `@softure-ai/security`, and its route guard is separate from
7
+ channel tagging.
9
8
 
10
9
  ## 1. What it provides
11
10
 
12
11
  Users and sessions in the `auth` schema, scrypt password hashes, opaque session cookies, register,
13
12
  login, logout, password change and password reset as server actions and pages, `getCurrentUser` / `requireUser`
14
13
  for server code, roles (`requireRole`, `authorizeRole`, `hasRole`, and `grant-role` /
15
- `revoke-role` scripts), `createAuthGuard` for the app's `proxy.ts`, and a health check that
14
+ `revoke-role` scripts), account recovery (`revokeUserSessions` and a `set-temporary-password`
15
+ script), `createAuthGuard` for the app's `proxy.ts`, and a health check that
16
16
  `GET /api/health` of `@softure-ai/ops` runs (every auth table answers, no rows read).
17
17
  `@softure-ai/auth/mailing` sends password reset mails through `@softure-ai/mailing`
18
- (`mailingResetSender()`).
18
+ (`mailingResetSender()`). `@softure-ai/auth/testing` creates accounts directly in the database for
19
+ tests (`createTestAccount`, section 4, "Tests").
19
20
 
20
21
  ## 2. Installation
21
22
 
22
23
  ```bash
23
24
  npm install @softure-ai/auth @softure-ai/security @softure-ai/core @softure-ai/db @softure-ai/ui drizzle-orm
24
- # for the role scripts (section 4, "Roles"), already a dependency of auth:
25
+ # only for the ops scripts in @softure-ai/auth/scripts (section 4, "Roles" and "Account recovery"):
25
26
  npm install @softure-ai/ops
26
27
  ```
27
28
 
28
- Peer dependencies: `next` 16, `react` 19, `drizzle-orm`; `@softure-ai/mailing` (optional) for
29
- `@softure-ai/auth/mailing`.
29
+ Peer dependencies: `next` 16, `react` 19, `drizzle-orm`; optional: `@softure-ai/mailing` for
30
+ `@softure-ai/auth/mailing`, `@softure-ai/ops` for `@softure-ai/auth/scripts`. No other entry
31
+ imports them.
30
32
 
31
33
  ## 3. Configuration
32
34
 
@@ -42,7 +44,7 @@ const config = defineSoftureConfig({
42
44
  timezone: "Europe/Warsaw",
43
45
  appOrigin: process.env.APP_ORIGIN!,
44
46
  modules: [
45
- // auth counts attempts in these four buckets; change the numbers, keep the names.
47
+ // auth counts attempts in these buckets; change the numbers, keep the names.
46
48
  security({ clientIp: cloudflareIp(), buckets: { ...AUTH_RATE_LIMIT_BUCKETS } }),
47
49
  auth({
48
50
  routes: { afterLogin: "/dashboard" },
@@ -61,12 +63,14 @@ export default config;
61
63
  | Option | Type | Default | Meaning |
62
64
  | --- | --- | --- | --- |
63
65
  | `password.minLength` | `number` (8-128) | `10` | Shortest new password, in characters. The longest is 1024. |
64
- | `password.scrypt` | `{ cost, blockSize, parallelization }` | `{ 2 ** 17, 8, 1 }` | scrypt N, r, p (OWASP). Raising them rehashes each password at its owner's next login. |
66
+ | `password.scrypt` | `{ cost, blockSize, parallelization }` | `{ 2 ** 17, 8, 1 }` | scrypt N, r, p (OWASP). Raising them rehashes each password at its owner's next login. Memory: 128 × N × r bytes per hash, so the default takes 128 MiB and about 0.4 s of one core; Node runs up to four hashes at once (its libuv pool, `UV_THREADPOOL_SIZE`), about 512 MiB at a burst of logins. On a small server, lower `cost` to `2 ** 16` (64 MiB) or `2 ** 15` (32 MiB) and leave the pool at four. |
65
67
  | `session.ttlDays` | `number` (1-365) | `30` | Session lifetime from login. It is not extended by use. |
66
68
  | `cookie.name` | `string` | `"softure_session"` | Base name of the session cookie (see below). |
67
69
  | `cookie.domain` | `string` | none (host-only) | Share the session with subdomains, e.g. `example.com` for the apex and `app.example.com`. |
68
70
  | `cookie.secure` | `boolean` | `appOrigin` is https | Send the cookie over HTTPS only. |
69
71
  | `requireConsent` | `boolean` | `true` | Registration needs the consent checkbox. |
72
+ | `registrationFields` | `string[]` | `[]` | Extra register form fields handed to `onRegistered` as `event.fields` (section 10). Names: `a-z` first, then letters, digits or `_`, at most 32; not `email`, `password`, `next` or `consent`. |
73
+ | `legacySession` | `{ cookieName, tokenPattern }` | none | Sessions of the system the app took over (section 5, "Adopting existing sessions"). |
70
74
  | `registrationClosed` | `boolean` | `false` | Declared default of the `auth.registration_closed` switch. |
71
75
  | `roles` | `string[]` | `[]` | Role names the app checks besides `admin` (always declared): `a-z`, `0-9`, `_`, `-`, at most 32. |
72
76
  | `adminEmails` | `string[]` | `[]` | Initial admin list: while an email is listed, its account holds `admin`. Auth does not verify emails, so create these accounts before you deploy the list (section 4, "Roles"). |
@@ -86,11 +90,15 @@ per client address, `login-account` 10 per email, `change-password` 10 per user,
86
90
  `password-reset` 10 (link requests) and `password-reset-confirm` 10 (new passwords) per client
87
91
  address, `password-reset-account` 3 per email (the mails one address can get), each per 15
88
92
  minutes. Attempts are counted before any password is hashed. A successful login forgets the
89
- email's failed attempts, not the address's. `login-account` is a lockout by design: ten wrong
93
+ email's failed attempts, not the address's: the per-address `login` bucket counts every login,
94
+ successful or not, so a test suite that logs in many times from one address must raise `login`
95
+ (or give each test its own address). `login-account` is a lockout by design: ten wrong
90
96
  passwords for one email, from any addresses, block logins to that account for the rest of the
91
97
  window, the owner's included. Raise its limit if that trade-off is wrong for your app. Auth checks
92
- at its first call that all seven buckets exist and names the missing ones. A request whose client address cannot be resolved is
93
- refused (`security.client_unidentified`); see the security README for resolvers.
98
+ at its first call that the buckets it counts in exist and names the missing ones: the three
99
+ `password-reset*` buckets only when `passwordReset.send` is set. A request whose client address
100
+ cannot be resolved is refused (`security.client_unidentified`); the security README shows resolver
101
+ chains for production and for development and test stacks.
94
102
 
95
103
  ## 4. Mounting
96
104
 
@@ -110,6 +118,27 @@ export { ResetPasswordPage as default } from "@softure-ai/auth/next";
110
118
  export { getSessionRoute as GET } from "@softure-ai/auth/next";
111
119
  ```
112
120
 
121
+ The register page takes a consent label (links to your terms) and inputs of your own through
122
+ `createRegisterPage`, so you keep the module's page:
123
+
124
+ ```tsx
125
+ // app/register/page.tsx
126
+ import { createRegisterPage } from "@softure-ai/auth/next";
127
+
128
+ export default createRegisterPage({
129
+ consentLabel: (
130
+ <>
131
+ I accept the <a href="/terms">terms</a> and the <a href="/privacy">privacy policy</a>.
132
+ </>
133
+ ),
134
+ extraFields: <input type="hidden" name="plan" value="pro" />,
135
+ });
136
+ ```
137
+
138
+ A field reaches `onRegistered` only when its name is in `auth({ registrationFields })` (section 10).
139
+ The page also carries a declared field from its own URL as a hidden input, so with
140
+ `registrationFields: ["z"]` a visit to `/register?z=newsletter` hands `{ z: "newsletter" }` to the hook.
141
+
113
142
  The server actions (`loginAction`, `registerAction`, `changePasswordAction`, `forgotPasswordAction`,
114
143
  `resetPasswordAction`, `logoutAction`) need no mounting. In your own pages and layouts:
115
144
 
@@ -171,6 +200,18 @@ Next's `config`.)
171
200
  A protected prefix matches whole path segments (`/account` covers `/account/password`, not
172
201
  `/accounting`). The change-password route is always protected. Redirects are built on `appOrigin`.
173
202
 
203
+ An app that is private by default protects `"/"` and lists its public paths in `exclude`, which is
204
+ checked first:
205
+
206
+ ```ts
207
+ const guard = createAuthGuard(softureConfig, { protect: ["/"], exclude: ["/", "/pricing", "/blog", "/api/public"] });
208
+ ```
209
+
210
+ In `exclude`, `"/"` is the home page only; any other entry matches whole segments like `protect`.
211
+ Auth's own public pages (login, register, forgot and reset password) and `/api/auth/session` are
212
+ never guarded, so `protect: ["/"]` cannot send the login page to itself. The change-password route
213
+ stays guarded even under an excluded prefix.
214
+
174
215
  **Roles.** A role is a declared name (`admin`, plus `auth({ roles: ["editor"] })`) held by an
175
216
  account: as a row in `auth.user_roles`, or, for `admin` only, through `adminEmails`. Nothing is
176
217
  granted by default: with no admin listed and no rows, every admin-only surface stays closed.
@@ -221,6 +262,26 @@ not stored (revoke); an `admin` that comes from `adminEmails` is removed from th
221
262
  script. `grantRole`, `revokeRole` and `findUserRoles` in `@softure-ai/auth/server` do the same for
222
263
  your own code.
223
264
 
265
+ **Account recovery.** `revokeUserSessions(ctx, userId, { except? })` from `@softure-ai/auth/server`
266
+ ends every session of an account (all but `except`) and returns how many; each device logs in
267
+ again. For an owner who lost access without a reset mail, the `set-temporary-password` ops script
268
+ sets a random password (at least 20 characters, and at least `password.minLength`), ends every
269
+ session and the pending reset link, and prints the password once:
270
+
271
+ ```ts
272
+ // scripts/set-temporary-password.ts (bundled and run like grant-role)
273
+ import { createSetTemporaryPasswordScript } from "@softure-ai/auth/scripts";
274
+ import { runOpsScript } from "@softure-ai/ops/scripts";
275
+ import config from "../softure.config";
276
+
277
+ process.exitCode = await runOpsScript({ script: createSetTemporaryPasswordScript(config), argv: process.argv.slice(2), config });
278
+ ```
279
+
280
+ `node set-temporary-password.mjs --email=owner@example.com` shows what it would end and rolls back
281
+ (the printed password is not stored); `--commit` writes and prints the password to hand over. Send
282
+ it only to the account's own address, and ask the owner to change it after logging in: the module
283
+ does not force a change.
284
+
224
285
  **Password reset.** Pass a sender, and the login form links to the request page. With
225
286
  `@softure-ai/mailing` enabled, `mailingResetSender()` is that sender:
226
287
 
@@ -274,7 +335,28 @@ auth({
274
335
 
275
336
  **Your own forms.** `@softure-ai/auth/ui` exports `LoginForm`, `RegisterForm`,
276
337
  `ChangePasswordForm`, `ForgotPasswordForm` and `ResetPasswordForm`; pass them the actions from
277
- `@softure-ai/auth/next`.
338
+ `@softure-ai/auth/next`. `RegisterForm` takes `consentLabel` and `extraFields` like
339
+ `createRegisterPage`.
340
+
341
+ **Tests.** `createTestAccount(db, { email, password, roles?, scrypt? })` from `@softure-ai/auth/testing`
342
+ writes an account and its role rows in one transaction, hashed as registration hashes it, and returns
343
+ the `AuthUser`. It is for tests that need an account but are not about registration: no `onRegistered`
344
+ hook runs (no consent row) and no session is opened, so the test signs in through the login form.
345
+ Pass the app's parameters, so the first login does not rehash:
346
+
347
+ ```ts
348
+ import { getAuthOptions } from "@softure-ai/auth/server";
349
+ import { createTestAccount } from "@softure-ai/auth/testing";
350
+
351
+ const user = await createTestAccount(handle.db, {
352
+ email: "ada@example.com",
353
+ password: "correct horse battery",
354
+ roles: ["admin"],
355
+ scrypt: getAuthOptions(config).password.scrypt,
356
+ });
357
+ ```
358
+
359
+ An invalid or taken email throws. The entry is server-only and never imported by the module itself.
278
360
 
279
361
  ## 5. Migrations and tables
280
362
 
@@ -297,6 +379,26 @@ your own 1:1 table, never in `auth.users`. Expired sessions of a user are delete
297
379
  login; `pruneSessions(ctx)` from `@softure-ai/auth/server` deletes all of them for a scheduled job,
298
380
  and `prunePasswordResets(ctx)` does the same for expired reset links.
299
381
 
382
+ **Adopting existing sessions.** An app that moves to this module from its own auth can keep its
383
+ users, its password hashes when they are `scrypt$N$r$p$salt$key` strings, and its sessions when it
384
+ stored them as the sha256 hex of the token. Its cookie has another name and its tokens another
385
+ shape, so without more every user logs in once after the switch. To keep them signed in, declare
386
+ the old cookie:
387
+
388
+ ```ts
389
+ auth({ legacySession: { cookieName: "session", tokenPattern: /[0-9a-f]{64}/ } });
390
+ ```
391
+
392
+ `tokenPattern` describes the whole token (the module anchors it) and must not use the `g` or `y`
393
+ flag. While the current cookie is absent the old one is read, its token looked up by the same
394
+ sha256, and the route guard counts it. The next login, register or logout ends that session and
395
+ removes the old cookie (`Path=/` and `cookie.domain`; an old cookie set on another path or domain
396
+ stays until it expires, its session already ended). Legacy sessions keep their own expiry. Remove
397
+ the option once the longest of them has expired.
398
+
399
+ A password hashed from input that was not NFC still verifies: a login tries the input as given when
400
+ its NFC form fails, then rehashes it in NFC.
401
+
300
402
  ## 6. Environment variables
301
403
 
302
404
  | Name | Required | Meaning |
@@ -327,7 +429,8 @@ Without feature-switches, or while the app does not define the switch there, its
327
429
 
328
430
  Pages and forms are built from `@softure-ai/ui` (Card, fields, Checkbox, Button) and use only its
329
431
  compiled classes, so `@softure-ai/ui/styles.css` styles them and the `--sft-*` tokens theme them.
330
- Each form takes `classNames` for its slots (`root`, `form`, `footer`, `link`, `notice`) and
432
+ Each form takes `classNames` for its slots (`root`, `form`, `footer`, `link`, `notice`, and `submit`
433
+ for the submit button's class), `submitVariant` (a `Button` variant, `primary` by default) and
331
434
  `unstyled`; pages are server components you can replace with your own page around the forms.
332
435
 
333
436
  ## 9. Copy
@@ -341,10 +444,13 @@ looks one up.
341
444
 
342
445
  ## 10. Hooks
343
446
 
344
- `onRegistered({ user, consent }, ctx)`: after the user row is inserted, in the same transaction
345
- (`ctx.db` is the transaction). `consent` is `{ acceptedAt }`, or `null` with
346
- `requireConsent: false`. A thrown error rolls the registration back and the user sees a generic
347
- failure. `privacy` (engagement roadmap) stores the consent through it.
447
+ `onRegistered({ user, consent, fields }, ctx)`: after the user row is inserted, in the same
448
+ transaction (`ctx.db` is the transaction). `consent` is `{ acceptedAt }`, or `null` with
449
+ `requireConsent: false`. `fields` holds the declared `registrationFields` the form sent, by name
450
+ (strings cut to 512 characters, empty ones left out). They come from the client, and a link can set
451
+ a carried one, so validate them before you store them. The hook runs inside the register action,
452
+ so it can also read the request (`headers()`, `cookies()` from `next/headers`). A thrown error rolls the registration back and the user sees a generic
453
+ failure. `@softure-ai/privacy` stores the consent through it.
348
454
 
349
455
  `passwordReset.send(link, user, details)`: after a reset request is answered, for an existing
350
456
  account only (section 4, "Password reset"). `mailingResetSender()` from `@softure-ai/auth/mailing`
@@ -373,10 +479,13 @@ Rate limit rows of `security` hold only SHA-256 prefixes of the email and user i
373
479
 
374
480
  - Sessions have a fixed lifetime; there is no sliding renewal and no "remember me".
375
481
  - A password change keeps the session that made it (and ends every other one); the token itself
376
- is not rotated. Login and register end the session the browser held before.
482
+ is not rotated. The new password must differ from the current one (`auth.password_unchanged`). Login and register end the session the browser held before.
377
483
  - No email verification, so `adminEmails` trusts whoever registers a listed email first. (A reset
378
484
  link goes to the account's email, so its owner can take the account back.)
379
485
  - Roles are flat: no hierarchy and no permissions per role; no UI to manage them (the scripts do).
380
486
  - The guard checks cookie presence only; the session is verified by `requireUser`.
487
+ - A `next` path longer than 8192 characters is replaced by the default target, with a warning in
488
+ the log that names its length.
489
+ - A temporary password from the script is not forced to change at the next login.
381
490
  - A registration attempt reveals whether an email has an account (`auth.email_taken`); the
382
491
  `register` rate limit bounds how fast anyone can ask.
@@ -1,6 +1,6 @@
1
1
  import type { CoreErrorCode } from "@softure-ai/core";
2
2
  import type { SecurityErrorCode } from "@softure-ai/security";
3
- export type AuthErrorCode = "auth.invalid_credentials" | "auth.email_invalid" | "auth.email_taken" | "auth.password_too_short" | "auth.password_too_long" | "auth.consent_required" | "auth.registration_closed" | "auth.current_password_invalid" | "auth.unauthenticated" | "auth.forbidden" | "auth.reset_token_invalid" | "auth.password_reset_unavailable";
3
+ export type AuthErrorCode = "auth.invalid_credentials" | "auth.email_invalid" | "auth.email_taken" | "auth.password_too_short" | "auth.password_too_long" | "auth.consent_required" | "auth.registration_closed" | "auth.current_password_invalid" | "auth.password_unchanged" | "auth.unauthenticated" | "auth.forbidden" | "auth.reset_token_invalid" | "auth.password_reset_unavailable";
4
4
  /** Every code an auth form can show: its own, the rate limiter's and the generic ones. */
5
5
  export type AuthFormErrorCode = AuthErrorCode | Extract<SecurityErrorCode, "security.rate_limited" | "security.client_unidentified"> | CoreErrorCode;
6
6
  /** A signed-up account, as the app sees it. The password hash never leaves the module. */
@@ -25,6 +25,8 @@ export interface RegisteredEvent {
25
25
  readonly consent: {
26
26
  readonly acceptedAt: Date;
27
27
  } | null;
28
+ /** The declared `registrationFields` the form sent, by name; client input, so validate it. */
29
+ readonly fields: Readonly<Record<string, string>>;
28
30
  }
29
31
  /** The fields of the auth forms that can carry their own error. */
30
32
  export type AuthFormField = "email" | "password" | "currentPassword" | "newPassword" | "consent";
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,MAAM,MAAM,aAAa,GACrB,0BAA0B,GAC1B,oBAAoB,GACpB,kBAAkB,GAClB,yBAAyB,GACzB,wBAAwB,GACxB,uBAAuB,GACvB,0BAA0B,GAC1B,+BAA+B,GAC/B,sBAAsB,GACtB,gBAAgB,GAChB,0BAA0B,GAC1B,iCAAiC,CAAC;AAEtC,0FAA0F;AAC1F,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG,OAAO,CAAC,iBAAiB,EAAE,uBAAuB,GAAG,8BAA8B,CAAC,GAAG,aAAa,CAAC;AAErJ,0FAA0F;AAC1F,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;CAC1B;AAED,iFAAiF;AACjF,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;CAC1B;AAED,sCAAsC;AACtC,MAAM,WAAW,QAA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-1 +1 @@
1
- {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AA+DA,MAAM,CAAC,MAAM,uBAAuB,GAAkB,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAkEA,MAAM,CAAC,MAAM,uBAAuB,GAAkB,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -134,6 +134,7 @@ export declare const auth: import("@softure-ai/core").ModuleFactory<{
134
134
  consent_required: string;
135
135
  registration_closed: string;
136
136
  current_password_invalid: string;
137
+ password_unchanged: string;
137
138
  unauthenticated: string;
138
139
  forbidden: string;
139
140
  reset_token_invalid: string;
@@ -165,6 +166,11 @@ export declare const auth: import("@softure-ai/core").ModuleFactory<{
165
166
  domain: import("zod").ZodOptional<import("zod").ZodString>;
166
167
  secure: import("zod").ZodOptional<import("zod").ZodBoolean>;
167
168
  }, import("zod/v4/core").$strict>>;
169
+ legacySession: import("zod").ZodOptional<import("zod").ZodObject<{
170
+ cookieName: import("zod").ZodString;
171
+ tokenPattern: import("zod").ZodCustom<RegExp, RegExp>;
172
+ }, import("zod/v4/core").$strict>>;
173
+ registrationFields: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
168
174
  requireConsent: import("zod").ZodDefault<import("zod").ZodBoolean>;
169
175
  registrationClosed: import("zod").ZodDefault<import("zod").ZodBoolean>;
170
176
  roles: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,SAAS,SAAS,CAAC;AAEhC,2DAA2D;AAC3D,eAAO,MAAM,0BAA0B,6BAA6B,CAAC;AAErE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,4CAA4C,CAAC;AAEjF;;;;;GAKG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C,CAAC;AAEjF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQ1B,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCAwCf,CAAC;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,QAAQ,EACR,UAAU,EACV,eAAe,EACf,QAAQ,GACT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC3F,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC3I,OAAO,EAAE,0BAA0B,EAAE,KAAK,oBAAoB,EAAE,KAAK,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAC7H,OAAO,EAAE,gBAAgB,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -36,8 +36,8 @@ export const AUTH_RATE_LIMIT_BUCKETS = {
36
36
  export const auth = defineModule({
37
37
  manifest: {
38
38
  id: MODULE_ID,
39
- version: "0.1.5",
40
- dependsOn: { security: "^0.1.0" },
39
+ version: "0.1.7",
40
+ dependsOn: { security: "^0.1.0", mailing: "^0.1.0?", ops: "^0.1.0?" },
41
41
  dbSchema: "auth",
42
42
  tables: ["users", "sessions", "user_roles", "password_resets"],
43
43
  env: [
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,qIAAqI;AACrI,4EAA4E;AAC5E,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC;AAEhC,2DAA2D;AAC3D,MAAM,CAAC,MAAM,0BAA0B,GAAG,0BAA0B,CAAC;AAErE;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,yCAAyC,CAAC;AAEjF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE;IACzC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE;IACvC,eAAe,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE;IACjD,iBAAiB,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE;IACnD,gBAAgB,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE;IAClD,wBAAwB,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE;IACzD,wBA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YAAY,EAAE,mBAAmB,EAAqB,MAAM,qBAAqB,CAAC;AAE3F,OAAO,EAAE,0BAA0B,EAAuD,MAAM,4BAA4B,CAAC;AAC7H,OAAO,EAAE,gBAAgB,EAAsB,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC"}
@@ -79,6 +79,7 @@ export declare const en: {
79
79
  consent_required: string;
80
80
  registration_closed: string;
81
81
  current_password_invalid: string;
82
+ password_unchanged: string;
82
83
  unauthenticated: string;
83
84
  forbidden: string;
84
85
  reset_token_invalid: string;
@@ -1 +1 @@
1
- {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/messages/en.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA2DX,qFAAqF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BxF,CAAC"}
1
+ {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/messages/en.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA2DX,qFAAqF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCxF,CAAC"}
@@ -74,6 +74,7 @@ export const en = {
74
74
  consent_required: "You need to accept the terms to create an account.",
75
75
  registration_closed: "Registration is closed.",
76
76
  current_password_invalid: "The current password is incorrect.",
77
+ password_unchanged: "The new password must differ from the current one.",
77
78
  unauthenticated: "Your session has ended. Log in again.",
78
79
  forbidden: "You do not have access to this.",
79
80
  reset_token_invalid: "This link has expired or has already been used. Ask for a new one.",
@@ -1 +1 @@
1
- {"version":3,"file":"en.js","sourceRoot":"","sources":["../../src/messages/en.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,EAAE,GAAG;IAChB,MAAM,EAAE;QACN,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,UAAU;QACpB,eAAe,EAAE,kBAAkB;QACnC,WAAW,EAAE,cAAc;QAC3B,eAAe,EAAE,kCAAkC;QACnD,OAAO,EAAE,uDAAuD;KACjE;IACD,KAAK,EAAE;QACL,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE,eAAe;QACrB,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE,aAAa;QACtB,SAAS,EAAE,iBAAiB;QAC5B,YAAY,EAAE,YAAY;QAC1B,cAAc,EAAE,uBAAuB;KACxC;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,mBAAmB;QAC1B,IAAI,EAAE,oBAAoB;QAC1B,MAAM,EAAE,gBAAgB;QACxB,OAAO,EAAE,WAAW;QACpB,UAAU,EAAE,0BAA0B;QACtC,SAAS,EAAE,QAAQ;QACnB,WAAW,EAAE,wBAAwB;QACrC,UAAU,EAAE,4DAA4D;KACzE;IACD,cAAc,EAAE;QACd,KAAK,EAAE,iBAAiB;QACxB,IAAI,EAAE,6DAA6D;QACnE,MAAM,EAAE,iBAAiB;QACzB,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,iCAAiC;KAC3C;IACD,cAAc,EAAE;QACd,KAAK,EAAE,qBAAqB;QAC5B,IAAI,EAAE,oFAAoF;QAC1F,MAAM,EAAE,eAAe;QACvB,OAAO,EAAE,UAAU;QACnB,IAAI,EAAE,+GAA+G;QACrH,WAAW,EAAE,eAAe;KAC7B;IACD,aAAa,EAAE;QACb,KAAK,EAAE,oBAAoB;QAC3B,IAAI,EAAE,yCAAyC;QAC/C,MAAM,EAAE,cAAc;QACtB,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,0DAA0D;QACnE,YAAY,EAAE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GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,iBAAiB,EAAE;QAC7G,MAAM,EAAE,8EAA8E;KACvF;IACD,MAAM,EAAE;QACN,MAAM,EAAE,SAAS;KAClB;IACD,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,mBAAmB,EAAE,qCAAqC;YAC1D,aAAa,EAAE,8BAA8B;YAC7C,WAAW,EAAE,4CAA4C;YACzD,kBAAkB,EAAE,4BAA4B;YAChD,iBAAiB,EAAE,2BAA2B;YAC9C,gBAAgB,EAAE,oDAAoD;YACtE,mBAAmB,EAAE,yBAAyB;YAC9C,wBAAwB,EAAE,oCAAoC;YAC9D,kBAAkB,EAAE,oDAAoD;YACxE,eAAe,EAAE,uCAAuC;YACxD,SAAS,EAAE,iCAAiC;YAC5C,mBAAmB,EAAE,oEAAoE;YACzF,0BAA0B,EAAE,kCAAkC;SAC/D;QACD,QAAQ,EAAE;YACR,YAAY,EAAE,sDAAsD;YACpE,mBAAmB,EAAE,oEAAoE;SAC1F;QACD,IAAI,EAAE;YACJ,eAAe,EAAE,0DAA0D;YAC3E,UAAU,EAAE,0DAA0D;SACvE;KACF;CACF,CAAC"}
@@ -82,6 +82,7 @@ export declare const authMessages: {
82
82
  consent_required: string;
83
83
  registration_closed: string;
84
84
  current_password_invalid: string;
85
+ password_unchanged: string;
85
86
  unauthenticated: string;
86
87
  forbidden: string;
87
88
  reset_token_invalid: string;
@@ -177,6 +178,7 @@ export declare const authMessages: {
177
178
  consent_required: string;
178
179
  registration_closed: string;
179
180
  current_password_invalid: string;
181
+ password_unchanged: string;
180
182
  unauthenticated: string;
181
183
  forbidden: string;
182
184
  reset_token_invalid: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAG7B,6EAA6E;AAC7E,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAa,CAAC;AAEvC,MAAM,MAAM,YAAY,GAAG,OAAO,EAAE,CAAC;AAErC,4EAA4E;AAC5E,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAI3F"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAG7B,6EAA6E;AAC7E,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAa,CAAC;AAEvC,MAAM,MAAM,YAAY,GAAG,OAAO,EAAE,CAAC;AAErC,4EAA4E;AAC5E,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAI3F"}
@@ -1 +1 @@
1
- {"version":3,"file":"pl.d.ts","sourceRoot":"","sources":["../../src/messages/pl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAElC,eAAO,MAAM,EAAE,EAAE,OAAO,EAyFvB,CAAC"}
1
+ {"version":3,"file":"pl.d.ts","sourceRoot":"","sources":["../../src/messages/pl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAElC,eAAO,MAAM,EAAE,EAAE,OAAO,EA0FvB,CAAC"}
@@ -73,6 +73,7 @@ export const pl = {
73
73
  consent_required: "Aby założyć konto, zaakceptuj regulamin.",
74
74
  registration_closed: "Rejestracja jest zamknięta.",
75
75
  current_password_invalid: "Obecne hasło jest nieprawidłowe.",
76
+ password_unchanged: "Nowe hasło musi różnić się od obecnego.",
76
77
  unauthenticated: "Sesja wygasła. Zaloguj się ponownie.",
77
78
  forbidden: "Nie masz dostępu do tej funkcji.",
78
79
  reset_token_invalid: "Ten link wygasł albo został już użyty. Poproś o nowy.",
@@ -1 +1 @@
1
- {"version":3,"file":"pl.js","sourceRoot":"","sources":["../../src/messages/pl.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,EAAE,GAAc;IAC3B,MAAM,EAAE;QACN,KAAK,EAAE,QAAQ;QACf,QAAQ,EAAE,OAAO;QACjB,eAAe,EAAE,cAAc;QAC/B,WAAW,EAAE,YAAY;QACzB,eAAe,EAAE,iCAAiC;QAClD,OAAO,EAAE,6CAA6C;KACvD;IACD,KAAK,EAAE;QACL,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,iBAAiB;QACvB,MAAM,EAAE,aAAa;QACrB,OAAO,EAAE,YAAY;QACrB,SAAS,EAAE,yBAAyB;QACpC,YAAY,EAAE,UAAU;QACxB,cAAc,EAAE,sBAAsB;KACvC;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,mBAAmB;QACzB,MAAM,EAAE,aAAa;QACrB,OAAO,EAAE,aAAa;QACtB,UAAU,EAAE,iBAAiB;QAC7B,SAAS,EAAE,aAAa;QACxB,WAAW,EA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F;KACF;CACF,CAAC"}
@@ -14,6 +14,6 @@ export declare function forgotPasswordAction(_previous: AuthFormState, formData:
14
14
  * and its token is used by then.
15
15
  */
16
16
  export declare function resetPasswordAction(_previous: AuthFormState, formData: FormData): Promise<AuthFormState>;
17
- /** Ends the request's session and goes to `afterLogout`. The cookie is cleared even if the delete fails. */
17
+ /** Ends the request's sessions and goes to `afterLogout`. The cookies are cleared even if the delete fails. */
18
18
  export declare function logoutAction(): Promise<void>;
19
19
  //# sourceMappingURL=actions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/next/actions.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAoC,aAAa,EAAE,MAAM,gBAAgB,CAAC;AA4DtF,wBAAsB,WAAW,CAAC,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,CAiBtG;AAED,wBAAsB,cAAc,CAAC,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,CAuBzG;AAED,wBAAsB,oBAAoB,CAAC,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,CAgB/G;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,CAuB/G;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,CAkB9G;AAaD,4GAA4G;AAC5G,wBAAsB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAYlD"}
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/next/actions.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAoC,aAAa,EAAE,MAAM,gBAAgB,CAAC;AA8EtF,wBAAsB,WAAW,CAAC,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,CAiBtG;AAED,wBAAsB,cAAc,CAAC,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,CAwBzG;AAED,wBAAsB,oBAAoB,CAAC,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,CAgB/G;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,CAuB/G;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,CAkB9G;AAmBD,+GAA+G;AAC/G,wBAAsB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAWlD"}
@@ -12,8 +12,9 @@ import { redirect } from "next/navigation";
12
12
  import { after } from "next/server";
13
13
  import { z } from "zod";
14
14
  import { resolveRedirectTarget } from "../redirect-target.js";
15
- import { toSafeNextPath } from "../safe-next-path.js";
15
+ import { MAX_NEXT_PATH_LENGTH, toSafeNextPath } from "../safe-next-path.js";
16
16
  import { changePassword } from "../server/change-password.js";
17
+ import { getAuthOptions } from "../server/options.js";
17
18
  import { loginUser } from "../server/login.js";
18
19
  import { getAuthRoutes } from "../server/options.js";
19
20
  import { deliverPasswordReset, requestPasswordReset, resetPassword } from "../server/password-reset.js";
@@ -21,15 +22,20 @@ import { registerUser } from "../server/register.js";
21
22
  import { logoutSession } from "../server/sessions.js";
22
23
  import { getAuthContext } from "./context.js";
23
24
  import { PASSWORD_RESET_DONE_PARAM } from "./params.js";
24
- import { clearSessionCookie, readSessionToken, writeSessionCookie } from "./session-cookie.js";
25
+ import { clearSessionCookie, readLegacySessionToken, readSessionToken, writeSessionCookie } from "./session-cookie.js";
25
26
  /** Longer values are cut: the server functions refuse them anyway, and nothing huge is echoed back. */
26
27
  const MAX_FIELD_LENGTH = 4096;
27
28
  const text = z
28
29
  .string()
29
30
  .catch("")
30
31
  .transform((value) => value.slice(0, MAX_FIELD_LENGTH));
31
- const loginInput = z.object({ email: text, password: text, next: text });
32
- const registerInput = z.object({ email: text, password: text, next: text, consent: z.string().nullable().catch(null) });
32
+ // One character over the cap, so `toSafeNextPath` still sees an overlong path as overlong, not cut.
33
+ const nextPath = z
34
+ .string()
35
+ .catch("")
36
+ .transform((value) => value.slice(0, MAX_NEXT_PATH_LENGTH + 1));
37
+ const loginInput = z.object({ email: text, password: text, next: nextPath });
38
+ const registerInput = z.object({ email: text, password: text, next: nextPath, consent: z.string().nullable().catch(null) });
33
39
  const changePasswordInput = z.object({ currentPassword: text, newPassword: text });
34
40
  const forgotPasswordInput = z.object({ email: text });
35
41
  const resetPasswordInput = z.object({ token: text, newPassword: text });
@@ -42,6 +48,7 @@ const FIELD_OF = {
42
48
  };
43
49
  const CHANGE_FIELD_OF = {
44
50
  "auth.current_password_invalid": "currentPassword",
51
+ "auth.password_unchanged": "newPassword",
45
52
  "auth.password_too_short": "newPassword",
46
53
  "auth.password_too_long": "newPassword",
47
54
  };
@@ -57,6 +64,16 @@ function readForm(schema, formData) {
57
64
  // Every field has a `catch`, so parsing cannot fail.
58
65
  return schema.parse(raw);
59
66
  }
67
+ /** The app's declared registration fields the form sent as text; files and other names are ignored (the server cuts them to 512). */
68
+ function readRegistrationFields(config, formData) {
69
+ const fields = {};
70
+ for (const name of getAuthOptions(config).registrationFields) {
71
+ const value = formData.get(name);
72
+ if (typeof value === "string")
73
+ fields[name] = value.slice(0, MAX_FIELD_LENGTH);
74
+ }
75
+ return fields;
76
+ }
60
77
  function reportFailure(operation, error) {
61
78
  console.error(`@softure-ai/auth: ${operation} failed: ${errorLogLabel(error)}`);
62
79
  return safeError(error).error;
@@ -94,6 +111,7 @@ export async function registerAction(_previous, formData) {
94
111
  // A checked HTML checkbox sends "on" (or its value); an unchecked one sends nothing.
95
112
  hasConsented: input.consent !== null,
96
113
  clientKey: client.value,
114
+ fields: readRegistrationFields(config, formData),
97
115
  });
98
116
  }
99
117
  catch (error) {
@@ -180,23 +198,26 @@ export async function resetPasswordAction(_previous, formData) {
180
198
  return failure(result.error, { field: RESET_FIELD_OF[result.error] });
181
199
  redirect(await resolveRedirectTarget(config, `${getAuthRoutes(config).login}?${PASSWORD_RESET_DONE_PARAM}=1`));
182
200
  }
183
- /** Ends the session the browser held before a login or register, so it cannot be reused. */
201
+ /** Every session token the browser holds: the current cookie's and a legacy session's. */
202
+ async function readHeldTokens(config) {
203
+ const tokens = [await readSessionToken(config), await readLegacySessionToken(config)];
204
+ return [...new Set(tokens.filter((token) => token !== null))];
205
+ }
206
+ /** Ends the sessions the browser held before a login or register, so they cannot be reused. */
184
207
  async function endPreviousSession(config) {
185
- const previous = await readSessionToken(config);
186
- if (previous === null)
187
- return;
188
- try {
189
- await logoutSession(await getAuthContext(config), previous);
190
- }
191
- catch (error) {
192
- reportFailure("ending the previous session", error);
208
+ for (const previous of await readHeldTokens(config)) {
209
+ try {
210
+ await logoutSession(await getAuthContext(config), previous);
211
+ }
212
+ catch (error) {
213
+ reportFailure("ending the previous session", error);
214
+ }
193
215
  }
194
216
  }
195
- /** Ends the request's session and goes to `afterLogout`. The cookie is cleared even if the delete fails. */
217
+ /** Ends the request's sessions and goes to `afterLogout`. The cookies are cleared even if the delete fails. */
196
218
  export async function logoutAction() {
197
219
  const config = getSoftureConfig();
198
- const token = await readSessionToken(config);
199
- if (token !== null) {
220
+ for (const token of await readHeldTokens(config)) {
200
221
  try {
201
222
  await logoutSession(await getAuthContext(config), token);
202
223
  }