cauthy-auth 0.24.3 → 0.26.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/svelte.d.mts CHANGED
@@ -3,7 +3,7 @@ export { Account, AccountSession, AuthClient, AuthError, AuthMethods, AuthResult
3
3
  import { i as PublicSession } from './system-BxMsSIu1.mjs';
4
4
  export { P as PermissionOf, f as Policy, R as RoleOf, k as SessionOrganization, m as SessionUser, p as can, r as definePolicy } from './system-BxMsSIu1.mjs';
5
5
  import './theme.mjs';
6
- import './validate-B_iC-4y8.mjs';
6
+ import './validate-BTRit1O1.mjs';
7
7
  import 'jose';
8
8
 
9
9
  /** A value Svelte can read with `$`: its store contract. */
package/dist/svelte.d.ts CHANGED
@@ -3,7 +3,7 @@ export { Account, AccountSession, AuthClient, AuthError, AuthMethods, AuthResult
3
3
  import { i as PublicSession } from './system-DTIeDXDP.js';
4
4
  export { P as PermissionOf, f as Policy, R as RoleOf, k as SessionOrganization, m as SessionUser, p as can, r as definePolicy } from './system-DTIeDXDP.js';
5
5
  import './theme.js';
6
- import './validate-B_iC-4y8.js';
6
+ import './validate-BTRit1O1.js';
7
7
  import 'jose';
8
8
 
9
9
  /** A value Svelte can read with `$`: its store contract. */
package/dist/svelte.js CHANGED
@@ -172,6 +172,13 @@ function checkName(value) {
172
172
  if (typeof value !== "string" || value.trim().length > MAX_NAME) return { field: "name", code: "too_long", message: `Use at most ${MAX_NAME} characters.` };
173
173
  return null;
174
174
  }
175
+ var MAX_ORGANIZATION = 120;
176
+ function checkOrganization(value, required = false) {
177
+ const v = typeof value === "string" ? value.trim() : "";
178
+ if (v === "") return required ? { field: "organization", code: "required", message: "Enter your company's name." } : null;
179
+ if (v.length > MAX_ORGANIZATION) return { field: "organization", code: "too_long", message: `Use at most ${MAX_ORGANIZATION} characters.` };
180
+ return null;
181
+ }
175
182
  function checkCode(value) {
176
183
  const v = typeof value === "string" ? value.trim() : "";
177
184
  if (v === "") return { field: "code", code: "required", message: "Enter the code." };
@@ -278,6 +285,7 @@ function createAuthClient(options = {}) {
278
285
  mfa: (f) => post("/sign-in/mfa", { code: f.code }, checkCode(f.code)),
279
286
  mfaMethods: () => post("/sign-in/mfa/methods", {}, null),
280
287
  mfaSendCode: () => post("/sign-in/mfa/send", {}, null),
288
+ mfaSendEmail: () => post("/sign-in/mfa/email", {}, null),
281
289
  mfaPush: () => post("/sign-in/mfa/push", {}, null),
282
290
  async mfaPushWait(o = {}) {
283
291
  const status = await new Promise((resolve) => {
@@ -394,7 +402,12 @@ function createAuthClient(options = {}) {
394
402
  }
395
403
  },
396
404
  signUp: {
397
- email: (f) => post("/sign-up/email", { email: f.email, password: f.password, name: f.name }, firstProblem(checkName(f.name), checkEmail(f.email), checkNewPassword(f.password)), f.captchaToken)
405
+ email: (f) => post(
406
+ "/sign-up/email",
407
+ { email: f.email, password: f.password, name: f.name, organization: f.organization },
408
+ firstProblem(checkName(f.name), checkEmail(f.email), checkNewPassword(f.password), checkOrganization(f.organization)),
409
+ f.captchaToken
410
+ )
398
411
  },
399
412
  forgotPassword: (f) => post("/forgot-password", { email: f.email }, checkEmail(f.email), f.captchaToken),
400
413
  resetPassword: (f) => post("/reset-password", { token: f.token, password: f.password }, checkNewPassword(f.password)),