@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
@@ -19,8 +19,13 @@ export interface RegisterInput {
19
19
  readonly hasConsented: boolean;
20
20
  /** The client's rate limit key (`identifyClient`). */
21
21
  readonly clientKey: string;
22
+ /** Values of the app's `registrationFields`; other names are dropped. */
23
+ readonly fields?: Readonly<Record<string, string>>;
22
24
  }
23
25
 
26
+ /** Longest registration field value handed to the hook; longer ones are cut. */
27
+ const MAX_FIELD_LENGTH = 512;
28
+
24
29
  export type RegisterErrorCode =
25
30
  | "auth.registration_closed"
26
31
  | "auth.email_invalid"
@@ -65,8 +70,18 @@ export async function registerUser(ctx: AuthContext, input: RegisterInput): Prom
65
70
  if (row === undefined) return err("auth.email_taken");
66
71
  const user = { id: row.id, email: row.email, createdAt: row.createdAt };
67
72
 
68
- await options.onRegistered?.({ user, consent: options.requireConsent ? { acceptedAt: now } : null }, txCtx);
73
+ const fields = pickRegistrationFields(options.registrationFields, input.fields);
74
+ await options.onRegistered?.({ user, consent: options.requireConsent ? { acceptedAt: now } : null, fields }, txCtx);
69
75
  const session = await createSession(txCtx, user.id);
70
76
  return ok({ user, session });
71
77
  });
72
78
  }
79
+
80
+ function pickRegistrationFields(declared: readonly string[], sent: Readonly<Record<string, string>> | undefined): Record<string, string> {
81
+ const fields: Record<string, string> = {};
82
+ for (const name of declared) {
83
+ const value = sent !== undefined && Object.hasOwn(sent, name) ? sent[name] : undefined;
84
+ if (typeof value === "string" && value !== "") fields[name] = value.slice(0, MAX_FIELD_LENGTH);
85
+ }
86
+ return fields;
87
+ }
@@ -15,7 +15,11 @@ export function hashSessionToken(token: string): string {
15
15
  return createHash("sha256").update(token, "utf8").digest("hex");
16
16
  }
17
17
 
18
- /** Whether a cookie value could be a token at all; anything else is not looked up. */
19
- export function isSessionTokenShape(token: string): boolean {
20
- return TOKEN_SHAPE.test(token);
18
+ /**
19
+ * Whether a cookie value could be a token at all; anything else is not looked up. `legacyPattern`
20
+ * (from `legacySession.tokenPattern`, anchored and without the g or y flag) admits an adopted
21
+ * system's tokens, stored as the same sha256 hex.
22
+ */
23
+ export function isSessionTokenShape(token: string, legacyPattern?: RegExp): boolean {
24
+ return TOKEN_SHAPE.test(token) || (legacyPattern?.test(token) ?? false);
21
25
  }
@@ -1,10 +1,10 @@
1
1
  // Database sessions: one row per login, keyed by the sha256 of the cookie token, with a fixed expiry.
2
2
  import type { ModuleContext } from "@softure-ai/core";
3
3
  import type { Queryable } from "@softure-ai/db";
4
- import { and, eq, gt, lte } from "drizzle-orm";
4
+ import { and, eq, gt, lte, ne } from "drizzle-orm";
5
5
  import type { AuthUser, NewSession } from "../contract.js";
6
6
  import { sessions, users } from "../schema.js";
7
- import { getAuthOptions } from "./options.js";
7
+ import { getAuthOptions, getLegacyTokenPattern } from "./options.js";
8
8
  import { createSessionToken, hashSessionToken, isSessionTokenShape } from "./session-token.js";
9
9
 
10
10
  export type AuthContext = ModuleContext<Queryable>;
@@ -22,7 +22,7 @@ export async function createSession(ctx: AuthContext, userId: string): Promise<N
22
22
 
23
23
  /** The user of a live session, or null for an unknown, malformed or expired token. */
24
24
  export async function findSessionUser(ctx: AuthContext, token: string): Promise<AuthUser | null> {
25
- if (!isSessionTokenShape(token)) return null;
25
+ if (!isSessionTokenShape(token, getLegacyTokenPattern(ctx.config))) return null;
26
26
  const [row] = await ctx.db
27
27
  .select({ id: users.id, email: users.email, createdAt: users.createdAt })
28
28
  .from(sessions)
@@ -34,7 +34,7 @@ export async function findSessionUser(ctx: AuthContext, token: string): Promise<
34
34
 
35
35
  /** Ends one session. An unknown token is already logged out, so it is not an error. */
36
36
  export async function logoutSession(ctx: AuthContext, token: string): Promise<void> {
37
- if (!isSessionTokenShape(token)) return;
37
+ if (!isSessionTokenShape(token, getLegacyTokenPattern(ctx.config))) return;
38
38
  await ctx.db.delete(sessions).where(eq(sessions.tokenHash, hashSessionToken(token)));
39
39
  }
40
40
 
@@ -48,3 +48,18 @@ export async function pruneSessions(ctx: AuthContext): Promise<number> {
48
48
  export async function deleteExpiredSessions(ctx: AuthContext, userId: string): Promise<void> {
49
49
  await ctx.db.delete(sessions).where(and(eq(sessions.userId, userId), lte(sessions.expiresAt, ctx.clock.now())));
50
50
  }
51
+
52
+ export interface RevokeUserSessionsOptions {
53
+ /** A session token to keep, e.g. the one of the admin acting on their own account. */
54
+ readonly except?: string;
55
+ }
56
+
57
+ /**
58
+ * Ends every session of `userId` (all but `except`), e.g. after an account recovery or a suspected
59
+ * leak; each device must log in again. Returns how many sessions were ended.
60
+ */
61
+ export async function revokeUserSessions(ctx: AuthContext, userId: string, options: RevokeUserSessionsOptions = {}): Promise<number> {
62
+ const kept = options.except === undefined ? undefined : ne(sessions.tokenHash, hashSessionToken(options.except));
63
+ const deleted = await ctx.db.delete(sessions).where(and(eq(sessions.userId, userId), kept)).returning();
64
+ return deleted.length;
65
+ }
@@ -0,0 +1,43 @@
1
+ // An account written straight to auth's tables, hashed the way registration hashes it. No
2
+ // `onRegistered` hook runs and no session is opened: the test signs in through the login form.
3
+ import type { Queryable } from "@softure-ai/db";
4
+ import type { AuthUser } from "../contract.js";
5
+ import { DEFAULT_SCRYPT_COST, type ScryptParams } from "../options.js";
6
+ import { userRoles, users } from "../schema.js";
7
+ import { hashPassword } from "../server/password.js";
8
+ import { parseEmail } from "../server/validation.js";
9
+
10
+ /** Auth's own hash parameters when the app sets none (`password.scrypt` in `auth({ ... })`). */
11
+ const DEFAULT_SCRYPT: ScryptParams = { cost: DEFAULT_SCRYPT_COST, blockSize: 8, parallelization: 1 };
12
+
13
+ export interface TestAccountInput {
14
+ readonly email: string;
15
+ readonly password: string;
16
+ /** Rows of `auth.user_roles`, e.g. `["admin"]`. */
17
+ readonly roles?: readonly string[];
18
+ /** The app's hash parameters (`getAuthOptions(config).password.scrypt`), so its login does not rehash. */
19
+ readonly scrypt?: ScryptParams;
20
+ }
21
+
22
+ /**
23
+ * Creates an account and its roles in one transaction and returns it. The email is normalized as
24
+ * registration normalizes it. An invalid or taken email throws: in test setup it is a bug of the test.
25
+ */
26
+ export async function createTestAccount(db: Queryable, input: TestAccountInput): Promise<AuthUser> {
27
+ const email = parseEmail(input.email);
28
+ if (!email.ok) throw new Error(`createTestAccount: "${input.email}" is not a valid email`);
29
+ const passwordHash = await hashPassword(input.password, input.scrypt ?? DEFAULT_SCRYPT);
30
+ const now = new Date();
31
+
32
+ return db.transaction(async (tx) => {
33
+ const [row] = await tx
34
+ .insert(users)
35
+ .values({ email: email.value, passwordHash, createdAt: now, passwordChangedAt: now })
36
+ .onConflictDoNothing({ target: users.email })
37
+ .returning();
38
+ if (row === undefined) throw new Error(`createTestAccount: an account with the email "${email.value}" already exists`);
39
+ const roles = input.roles ?? [];
40
+ if (roles.length > 0) await tx.insert(userRoles).values(roles.map((role) => ({ userId: row.id, role, grantedAt: now })));
41
+ return { id: row.id, email: row.email, createdAt: row.createdAt };
42
+ });
43
+ }
@@ -0,0 +1,3 @@
1
+ // Test helpers of @softure-ai/auth: accounts created directly in the database, for tests that need
2
+ // a user but are not about registration. Server-only; never imported by the module's runtime code.
3
+ export { createTestAccount, type TestAccountInput } from "./account.js";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  import { formatMessage, type Locale } from "@softure-ai/core";
4
- import { Button, Checkbox, type ClassNames, createSlotClassGetter, FormError, PasswordField, TextField } from "@softure-ai/ui";
4
+ import { Button, type ButtonVariant, Checkbox, type ClassNames, createSlotClassGetter, FormError, PasswordField, TextField } from "@softure-ai/ui";
5
5
  import { type ReactNode, useActionState } from "react";
6
6
  import { type AuthFormField, type AuthFormState, INITIAL_AUTH_FORM_STATE } from "../contract.js";
7
7
  import { type AuthMessages, getAuthErrorMessage } from "../messages/index.js";
@@ -12,7 +12,7 @@ import { type AuthMessages, getAuthErrorMessage } from "../messages/index.js";
12
12
 
13
13
  export type AuthFormAction = (previous: AuthFormState, formData: FormData) => Promise<AuthFormState>;
14
14
 
15
- export type AuthFormSlot = "root" | "form" | "footer" | "link" | "notice";
15
+ export type AuthFormSlot = "root" | "form" | "footer" | "link" | "notice" | "submit";
16
16
 
17
17
  interface AuthFormBaseProps {
18
18
  readonly action: AuthFormAction;
@@ -21,6 +21,8 @@ interface AuthFormBaseProps {
21
21
  readonly locale?: Locale;
22
22
  readonly classNames?: ClassNames<AuthFormSlot>;
23
23
  readonly unstyled?: boolean;
24
+ /** The submit button's look; `primary` by default. Its class goes in `classNames.submit`. */
25
+ readonly submitVariant?: ButtonVariant;
24
26
  }
25
27
 
26
28
  const DEFAULT_CLASSES: Readonly<Record<AuthFormSlot, string>> = {
@@ -29,6 +31,8 @@ const DEFAULT_CLASSES: Readonly<Record<AuthFormSlot, string>> = {
29
31
  footer: "sft:m-0 sft:text-sm sft:text-muted",
30
32
  link: "sft:font-medium sft:text-accent",
31
33
  notice: "sft:m-0 sft:text-sm sft:text-success",
34
+ // The button styles itself; the slot only carries the app's class.
35
+ submit: "",
32
36
  };
33
37
 
34
38
  /** The error of one field, or of the form when no field owns it. */
@@ -49,6 +53,7 @@ function FormShell({
49
53
  footer,
50
54
  slot,
51
55
  unstyled,
56
+ submitVariant = "primary",
52
57
  children,
53
58
  }: {
54
59
  formAction: (formData: FormData) => void;
@@ -59,6 +64,7 @@ function FormShell({
59
64
  footer?: ReactNode;
60
65
  slot: (part: AuthFormSlot) => string | undefined;
61
66
  unstyled: boolean | undefined;
67
+ submitVariant: ButtonVariant | undefined;
62
68
  children: ReactNode;
63
69
  }) {
64
70
  return (
@@ -66,7 +72,7 @@ function FormShell({
66
72
  <form action={formAction} className={slot("form")}>
67
73
  {children}
68
74
  <FormError message={formError} unstyled={unstyled} />
69
- <Button type="submit" variant="primary" fullWidth pending={isPending} unstyled={unstyled}>
75
+ <Button type="submit" variant={submitVariant} fullWidth pending={isPending} classNames={{ root: slot("submit") }} unstyled={unstyled}>
70
76
  {isPending ? pendingLabel : submitLabel}
71
77
  </Button>
72
78
  </form>
@@ -86,7 +92,7 @@ export interface LoginFormProps extends AuthFormBaseProps {
86
92
  readonly notice?: string;
87
93
  }
88
94
 
89
- export function LoginForm({ action, messages, locale, next, registerHref, forgotPasswordHref, notice, classNames, unstyled }: LoginFormProps) {
95
+ export function LoginForm({ action, messages, locale, next, registerHref, forgotPasswordHref, notice, classNames, unstyled, submitVariant }: LoginFormProps) {
90
96
  const [state, formAction, isPending] = useActionState(action, INITIAL_AUTH_FORM_STATE);
91
97
  const errors = useErrors(state, messages);
92
98
  const slot = createSlotClassGetter({ defaults: DEFAULT_CLASSES, classNames, unstyled });
@@ -125,6 +131,7 @@ export function LoginForm({ action, messages, locale, next, registerHref, forgot
125
131
  footer={footer}
126
132
  slot={slot}
127
133
  unstyled={unstyled}
134
+ submitVariant={submitVariant}
128
135
  >
129
136
  {next === undefined ? null : <input type="hidden" name="next" value={next} />}
130
137
  <TextField
@@ -159,6 +166,11 @@ export interface RegisterFormProps extends AuthFormBaseProps {
159
166
  readonly minPasswordLength: number;
160
167
  /** The consent statement; may contain links to the terms. Defaults to `messages.fields.consent`. */
161
168
  readonly consentLabel?: ReactNode;
169
+ /**
170
+ * The app's own inputs, before the consent checkbox. Their values reach `onRegistered` as
171
+ * `event.fields` when their names are declared in `auth({ registrationFields })`.
172
+ */
173
+ readonly extraFields?: ReactNode;
162
174
  }
163
175
 
164
176
  export function RegisterForm({
@@ -170,8 +182,10 @@ export function RegisterForm({
170
182
  requireConsent,
171
183
  minPasswordLength,
172
184
  consentLabel,
185
+ extraFields,
173
186
  classNames,
174
187
  unstyled,
188
+ submitVariant,
175
189
  }: RegisterFormProps) {
176
190
  const [state, formAction, isPending] = useActionState(action, INITIAL_AUTH_FORM_STATE);
177
191
  const errors = useErrors(state, messages);
@@ -195,6 +209,7 @@ export function RegisterForm({
195
209
  footer={footer}
196
210
  slot={slot}
197
211
  unstyled={unstyled}
212
+ submitVariant={submitVariant}
198
213
  >
199
214
  {next === undefined ? null : <input type="hidden" name="next" value={next} />}
200
215
  <TextField
@@ -218,6 +233,7 @@ export function RegisterForm({
218
233
  unstyled={unstyled}
219
234
  locale={locale}
220
235
  />
236
+ {extraFields}
221
237
  {requireConsent ? (
222
238
  <Checkbox name="consent" label={consentLabel ?? messages.fields.consent} required error={errors.at("consent")} unstyled={unstyled} />
223
239
  ) : null}
@@ -229,7 +245,7 @@ export interface ChangePasswordFormProps extends AuthFormBaseProps {
229
245
  readonly minPasswordLength: number;
230
246
  }
231
247
 
232
- export function ChangePasswordForm({ action, messages, locale, minPasswordLength, classNames, unstyled }: ChangePasswordFormProps) {
248
+ export function ChangePasswordForm({ action, messages, locale, minPasswordLength, classNames, unstyled, submitVariant }: ChangePasswordFormProps) {
233
249
  const [state, formAction, isPending] = useActionState(action, INITIAL_AUTH_FORM_STATE);
234
250
  const errors = useErrors(state, messages);
235
251
  const slot = createSlotClassGetter({ defaults: DEFAULT_CLASSES, classNames, unstyled });
@@ -249,6 +265,7 @@ export function ChangePasswordForm({ action, messages, locale, minPasswordLength
249
265
  footer={notice}
250
266
  slot={slot}
251
267
  unstyled={unstyled}
268
+ submitVariant={submitVariant}
252
269
  >
253
270
  <PasswordField
254
271
  name="currentPassword"
@@ -279,7 +296,7 @@ export interface ForgotPasswordFormProps extends AuthFormBaseProps {
279
296
  }
280
297
 
281
298
  /** Asks for a reset link. Its confirmation is the same whether or not the email has an account. */
282
- export function ForgotPasswordForm({ action, messages, locale, ttlMinutes, loginHref, classNames, unstyled }: ForgotPasswordFormProps) {
299
+ export function ForgotPasswordForm({ action, messages, locale, ttlMinutes, loginHref, classNames, unstyled, submitVariant }: ForgotPasswordFormProps) {
283
300
  const [state, formAction, isPending] = useActionState(action, INITIAL_AUTH_FORM_STATE);
284
301
  const errors = useErrors(state, messages);
285
302
  const slot = createSlotClassGetter({ defaults: DEFAULT_CLASSES, classNames, unstyled });
@@ -311,6 +328,7 @@ export function ForgotPasswordForm({ action, messages, locale, ttlMinutes, login
311
328
  footer={backToLogin}
312
329
  slot={slot}
313
330
  unstyled={unstyled}
331
+ submitVariant={submitVariant}
314
332
  >
315
333
  <TextField
316
334
  name="email"
@@ -334,7 +352,7 @@ export interface ResetPasswordFormProps extends AuthFormBaseProps {
334
352
  }
335
353
 
336
354
  /** Sets a new password from a reset link; its action goes to the login page on success. */
337
- export function ResetPasswordForm({ action, messages, locale, token, minPasswordLength, classNames, unstyled }: ResetPasswordFormProps) {
355
+ export function ResetPasswordForm({ action, messages, locale, token, minPasswordLength, classNames, unstyled, submitVariant }: ResetPasswordFormProps) {
338
356
  const [state, formAction, isPending] = useActionState(action, INITIAL_AUTH_FORM_STATE);
339
357
  const errors = useErrors(state, messages);
340
358
  const slot = createSlotClassGetter({ defaults: DEFAULT_CLASSES, classNames, unstyled });
@@ -347,6 +365,7 @@ export function ResetPasswordForm({ action, messages, locale, token, minPassword
347
365
  formError={errors.form}
348
366
  slot={slot}
349
367
  unstyled={unstyled}
368
+ submitVariant={submitVariant}
350
369
  >
351
370
  <input type="hidden" name="token" value={token} />
352
371
  <PasswordField