cauthy-auth 0.24.2 → 0.25.0
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.
- package/dist/client.d.mts +12 -3
- package/dist/client.d.ts +12 -3
- package/dist/client.js +13 -1
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +13 -1
- package/dist/client.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +16 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -4
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +13 -2
- package/dist/react.d.ts +13 -2
- package/dist/react.js +23 -5
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +23 -5
- package/dist/react.mjs.map +1 -1
- package/dist/svelte.d.mts +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/svelte.js +13 -1
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +13 -1
- package/dist/svelte.mjs.map +1 -1
- package/dist/{validate-B_iC-4y8.d.mts → validate-BTRit1O1.d.mts} +1 -1
- package/dist/{validate-B_iC-4y8.d.ts → validate-BTRit1O1.d.ts} +1 -1
- package/dist/vue.d.mts +1 -1
- package/dist/vue.d.ts +1 -1
- package/dist/vue.js +13 -1
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +13 -1
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
package/dist/client.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CauthyTheme } from './theme.mjs';
|
|
2
2
|
import { i as PublicSession } from './system-BxMsSIu1.mjs';
|
|
3
|
-
import { A as AuthField } from './validate-
|
|
4
|
-
export { F as FieldProblem, M as MIN_PASSWORD, c as checkCode, a as checkEmail, b as checkName, d as checkNewPassword, e as checkPassword } from './validate-
|
|
3
|
+
import { A as AuthField } from './validate-BTRit1O1.mjs';
|
|
4
|
+
export { F as FieldProblem, M as MIN_PASSWORD, c as checkCode, a as checkEmail, b as checkName, d as checkNewPassword, e as checkPassword } from './validate-BTRit1O1.mjs';
|
|
5
5
|
import 'jose';
|
|
6
6
|
|
|
7
7
|
/** Whether this browser can use a passkey at all. */
|
|
@@ -78,6 +78,11 @@ interface AuthMethods {
|
|
|
78
78
|
}[];
|
|
79
79
|
/** Whether people may create an account themselves. */
|
|
80
80
|
signUp: boolean;
|
|
81
|
+
/** Set when the application's system makes an organization per sign-up: the form asks the company's name. */
|
|
82
|
+
organization?: {
|
|
83
|
+
ask: boolean;
|
|
84
|
+
required: boolean;
|
|
85
|
+
};
|
|
81
86
|
magicLink: boolean;
|
|
82
87
|
/** Whether to offer a passkey. */
|
|
83
88
|
passkey: boolean;
|
|
@@ -597,6 +602,7 @@ interface AuthClient {
|
|
|
597
602
|
email: string;
|
|
598
603
|
password: string;
|
|
599
604
|
name?: string;
|
|
605
|
+
organization?: string;
|
|
600
606
|
captchaToken?: string;
|
|
601
607
|
}): Promise<AuthResult<'signed_in', {
|
|
602
608
|
session: PublicSession;
|
|
@@ -615,9 +621,12 @@ interface AuthClient {
|
|
|
615
621
|
password: string;
|
|
616
622
|
}): Promise<AuthResult<'changed'>>;
|
|
617
623
|
/** Confirms the address, with the token the mailed link opened the page with (`token`). */
|
|
624
|
+
/** Confirms the address a mailed link is for. The person is signed in from the link when their account asks no second step. */
|
|
618
625
|
verifyEmail(form: {
|
|
619
626
|
token: string;
|
|
620
|
-
}): Promise<AuthResult<'verified'
|
|
627
|
+
}): Promise<AuthResult<'verified'> | AuthResult<'signed_in', {
|
|
628
|
+
session: PublicSession;
|
|
629
|
+
}>>;
|
|
621
630
|
signOut(): Promise<AuthResult<'signed_out'>>;
|
|
622
631
|
/** The signed-in person's own account. */
|
|
623
632
|
account: AccountClient;
|
package/dist/client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CauthyTheme } from './theme.js';
|
|
2
2
|
import { i as PublicSession } from './system-DTIeDXDP.js';
|
|
3
|
-
import { A as AuthField } from './validate-
|
|
4
|
-
export { F as FieldProblem, M as MIN_PASSWORD, c as checkCode, a as checkEmail, b as checkName, d as checkNewPassword, e as checkPassword } from './validate-
|
|
3
|
+
import { A as AuthField } from './validate-BTRit1O1.js';
|
|
4
|
+
export { F as FieldProblem, M as MIN_PASSWORD, c as checkCode, a as checkEmail, b as checkName, d as checkNewPassword, e as checkPassword } from './validate-BTRit1O1.js';
|
|
5
5
|
import 'jose';
|
|
6
6
|
|
|
7
7
|
/** Whether this browser can use a passkey at all. */
|
|
@@ -78,6 +78,11 @@ interface AuthMethods {
|
|
|
78
78
|
}[];
|
|
79
79
|
/** Whether people may create an account themselves. */
|
|
80
80
|
signUp: boolean;
|
|
81
|
+
/** Set when the application's system makes an organization per sign-up: the form asks the company's name. */
|
|
82
|
+
organization?: {
|
|
83
|
+
ask: boolean;
|
|
84
|
+
required: boolean;
|
|
85
|
+
};
|
|
81
86
|
magicLink: boolean;
|
|
82
87
|
/** Whether to offer a passkey. */
|
|
83
88
|
passkey: boolean;
|
|
@@ -597,6 +602,7 @@ interface AuthClient {
|
|
|
597
602
|
email: string;
|
|
598
603
|
password: string;
|
|
599
604
|
name?: string;
|
|
605
|
+
organization?: string;
|
|
600
606
|
captchaToken?: string;
|
|
601
607
|
}): Promise<AuthResult<'signed_in', {
|
|
602
608
|
session: PublicSession;
|
|
@@ -615,9 +621,12 @@ interface AuthClient {
|
|
|
615
621
|
password: string;
|
|
616
622
|
}): Promise<AuthResult<'changed'>>;
|
|
617
623
|
/** Confirms the address, with the token the mailed link opened the page with (`token`). */
|
|
624
|
+
/** Confirms the address a mailed link is for. The person is signed in from the link when their account asks no second step. */
|
|
618
625
|
verifyEmail(form: {
|
|
619
626
|
token: string;
|
|
620
|
-
}): Promise<AuthResult<'verified'
|
|
627
|
+
}): Promise<AuthResult<'verified'> | AuthResult<'signed_in', {
|
|
628
|
+
session: PublicSession;
|
|
629
|
+
}>>;
|
|
621
630
|
signOut(): Promise<AuthResult<'signed_out'>>;
|
|
622
631
|
/** The signed-in person's own account. */
|
|
623
632
|
account: AccountClient;
|
package/dist/client.js
CHANGED
|
@@ -179,6 +179,13 @@ function checkName(value) {
|
|
|
179
179
|
if (typeof value !== "string" || value.trim().length > MAX_NAME) return { field: "name", code: "too_long", message: `Use at most ${MAX_NAME} characters.` };
|
|
180
180
|
return null;
|
|
181
181
|
}
|
|
182
|
+
var MAX_ORGANIZATION = 120;
|
|
183
|
+
function checkOrganization(value, required = false) {
|
|
184
|
+
const v = typeof value === "string" ? value.trim() : "";
|
|
185
|
+
if (v === "") return required ? { field: "organization", code: "required", message: "Enter your company's name." } : null;
|
|
186
|
+
if (v.length > MAX_ORGANIZATION) return { field: "organization", code: "too_long", message: `Use at most ${MAX_ORGANIZATION} characters.` };
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
182
189
|
function checkCode(value) {
|
|
183
190
|
const v = typeof value === "string" ? value.trim() : "";
|
|
184
191
|
if (v === "") return { field: "code", code: "required", message: "Enter the code." };
|
|
@@ -509,7 +516,12 @@ function createAuthClient(options = {}) {
|
|
|
509
516
|
}
|
|
510
517
|
},
|
|
511
518
|
signUp: {
|
|
512
|
-
email: (f) => post(
|
|
519
|
+
email: (f) => post(
|
|
520
|
+
"/sign-up/email",
|
|
521
|
+
{ email: f.email, password: f.password, name: f.name, organization: f.organization },
|
|
522
|
+
firstProblem(checkName(f.name), checkEmail(f.email), checkNewPassword(f.password), checkOrganization(f.organization)),
|
|
523
|
+
f.captchaToken
|
|
524
|
+
)
|
|
513
525
|
},
|
|
514
526
|
forgotPassword: (f) => post("/forgot-password", { email: f.email }, checkEmail(f.email), f.captchaToken),
|
|
515
527
|
resetPassword: (f) => post("/reset-password", { token: f.token, password: f.password }, checkNewPassword(f.password)),
|