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/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." };
@@ -394,7 +401,12 @@ function createAuthClient(options = {}) {
394
401
  }
395
402
  },
396
403
  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)
404
+ email: (f) => post(
405
+ "/sign-up/email",
406
+ { email: f.email, password: f.password, name: f.name, organization: f.organization },
407
+ firstProblem(checkName(f.name), checkEmail(f.email), checkNewPassword(f.password), checkOrganization(f.organization)),
408
+ f.captchaToken
409
+ )
398
410
  },
399
411
  forgotPassword: (f) => post("/forgot-password", { email: f.email }, checkEmail(f.email), f.captchaToken),
400
412
  resetPassword: (f) => post("/reset-password", { token: f.token, password: f.password }, checkNewPassword(f.password)),