@udibo/oauth2 0.55.0 → 0.55.1

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.
@@ -9,7 +9,7 @@ import { AuthFormClassNamesScope, useAuthFormClassNames, } from "./class-names.j
9
9
  */
10
10
  export function AuthFormShell(props) {
11
11
  const { name, form, className, classNames, render, rootProps, aboveForm, succeeded, children, action, method, formRef, } = props;
12
- return (_jsx(AuthFormClassNamesScope, { classNames: classNames, children: render ? (render(form)) : (_jsxs("div", { "data-oauth2-form": name, ...rootProps, className: combineClassNames(className, classNames.root), children: [aboveForm, succeeded ?? (_jsxs("form", { onSubmit: form.handleSubmit, action: action, method: method ?? (action ? "post" : undefined), ref: formRef, noValidate: true, "data-oauth2-form-element": "", className: classNames.form, children: [_jsx(ErrorSummary, { error: form.formError, focusTrigger: form.submitCount }), children] }))] })) }));
12
+ return (_jsx(AuthFormClassNamesScope, { classNames: classNames, children: render ? (render(form)) : (_jsxs("div", { "data-oauth2-form": name, ...rootProps, className: combineClassNames(className, classNames.root), children: [aboveForm, succeeded ?? (_jsxs("form", { onSubmit: form.handleSubmit, action: action, method: method ?? "post", ref: formRef, noValidate: true, "data-oauth2-form-element": "", className: classNames.form, children: [_jsx(ErrorSummary, { error: form.formError, focusTrigger: form.submitCount }), children] }))] })) }));
13
13
  }
14
14
  function ignoreActivation(event) {
15
15
  event.preventDefault();
@@ -31,8 +31,10 @@
31
31
  *
32
32
  * ## Server-rendered pages
33
33
  *
34
- * Pass `action` + `method` and the rendered `<form>` carries them, so a
35
- * server-rendered page still posts when JavaScript never arrives — every
34
+ * Every rendered `<form>` uses `method="post"` unless you pass `method`, so a
35
+ * submit before React hydrates never puts credentials in the URL. Pass
36
+ * `action` and the form carries it, so a server-rendered page still posts to
37
+ * that route when JavaScript never arrives — every
36
38
  * rendered field carries its `name`, so the native post sends those fields
37
39
  * under the keys `onSubmit` receives. Values a form holds without rendering a
38
40
  * field for them are absent from a native post: `ResetPasswordForm`'s
@@ -31,8 +31,10 @@
31
31
  *
32
32
  * ## Server-rendered pages
33
33
  *
34
- * Pass `action` + `method` and the rendered `<form>` carries them, so a
35
- * server-rendered page still posts when JavaScript never arrives — every
34
+ * Every rendered `<form>` uses `method="post"` unless you pass `method`, so a
35
+ * submit before React hydrates never puts credentials in the URL. Pass
36
+ * `action` and the form carries it, so a server-rendered page still posts to
37
+ * that route when JavaScript never arrives — every
36
38
  * rendered field carries its `name`, so the native post sends those fields
37
39
  * under the keys `onSubmit` receives. Values a form holds without rendering a
38
40
  * field for them are absent from a native post: `ResetPasswordForm`'s
@@ -216,10 +216,10 @@ export interface BaseAuthFormProps<V extends AuthFormValues> {
216
216
  */
217
217
  classNames?: AuthFormClassNames;
218
218
  /**
219
- * `action` for the rendered `<form>`. Set it (with {@link method}) on a
220
- * server-rendered page so the form still posts when JavaScript never
221
- * arrives; every rendered field carries its `name`, so a native post sends
222
- * those fields under the keys `onSubmit` receives. A value the form holds
219
+ * `action` for the rendered `<form>`. Set it on a server-rendered page so
220
+ * the form still posts to that route when JavaScript never arrives; every
221
+ * rendered field carries its `name`, so a native post sends those fields
222
+ * under the keys `onSubmit` receives. A value the form holds
223
223
  * without a rendered field (such as `ResetPasswordForm`'s `token`) is not
224
224
  * posted, so the server's handler must obtain it another way. Once React is
225
225
  * running, `onSubmit` handles the submit and the native post is suppressed.
@@ -228,11 +228,12 @@ export interface BaseAuthFormProps<V extends AuthFormValues> {
228
228
  */
229
229
  action?: string;
230
230
  /**
231
- * `method` for the rendered `<form>`. Defaults to `"post"` whenever
232
- * {@link action} is set, because the fields these forms render — passwords
233
- * and one-time codes — must never reach a URL, where a `get` form
234
- * would put them: browser history, the `Referer` sent to every third-party
235
- * asset on the destination page, and the server's access log.
231
+ * `method` for the rendered `<form>`. Defaults to `"post"`, with or without
232
+ * {@link action}. A submit before React hydrates, or after its bundle fails
233
+ * to load, is a native one; with no `action` it posts back to the current
234
+ * page. Do not pass `"get"`: it puts the fields these forms render —
235
+ * passwords, one-time codes, email addresses — in the URL, browser history
236
+ * and the server's access log.
236
237
  */
237
238
  method?: "get" | "post";
238
239
  /**
@@ -113,7 +113,7 @@ export interface AuthFormState<V extends AuthFormValues> {
113
113
  * },
114
114
  * });
115
115
  * return (
116
- * <form onSubmit={form.handleSubmit}>
116
+ * <form method="post" onSubmit={form.handleSubmit}>
117
117
  * <input {...form.getFieldProps("identifier")} />
118
118
  * <input {...form.getFieldProps("password")} type="password" />
119
119
  * {form.formError ? <p role="alert">{form.formError}</p> : null}
@@ -30,7 +30,7 @@ import { useCallback, useId, useMemo, useRef, useState, } from "react";
30
30
  * },
31
31
  * });
32
32
  * return (
33
- * <form onSubmit={form.handleSubmit}>
33
+ * <form method="post" onSubmit={form.handleSubmit}>
34
34
  * <input {...form.getFieldProps("identifier")} />
35
35
  * <input {...form.getFieldProps("password")} type="password" />
36
36
  * {form.formError ? <p role="alert">{form.formError}</p> : null}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@udibo/oauth2",
3
- "version": "0.55.0",
3
+ "version": "0.55.1",
4
4
  "description": "A flexible OAuth2 toolkit: framework-agnostic authorization & resource servers, a typed client, Hono adapters (including a backend-for-frontend), Express adapters, and React bindings.",
5
5
  "keywords": [
6
6
  "authorization-server",