cauthy-auth 0.24.3 → 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.mjs CHANGED
@@ -144,6 +144,13 @@ function checkName(value) {
144
144
  if (typeof value !== "string" || value.trim().length > MAX_NAME) return { field: "name", code: "too_long", message: `Use at most ${MAX_NAME} characters.` };
145
145
  return null;
146
146
  }
147
+ var MAX_ORGANIZATION = 120;
148
+ function checkOrganization(value, required = false) {
149
+ const v = typeof value === "string" ? value.trim() : "";
150
+ if (v === "") return required ? { field: "organization", code: "required", message: "Enter your company's name." } : null;
151
+ if (v.length > MAX_ORGANIZATION) return { field: "organization", code: "too_long", message: `Use at most ${MAX_ORGANIZATION} characters.` };
152
+ return null;
153
+ }
147
154
  function checkCode(value) {
148
155
  const v = typeof value === "string" ? value.trim() : "";
149
156
  if (v === "") return { field: "code", code: "required", message: "Enter the code." };
@@ -366,7 +373,12 @@ function createAuthClient(options = {}) {
366
373
  }
367
374
  },
368
375
  signUp: {
369
- 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)
376
+ email: (f) => post(
377
+ "/sign-up/email",
378
+ { email: f.email, password: f.password, name: f.name, organization: f.organization },
379
+ firstProblem(checkName(f.name), checkEmail(f.email), checkNewPassword(f.password), checkOrganization(f.organization)),
380
+ f.captchaToken
381
+ )
370
382
  },
371
383
  forgotPassword: (f) => post("/forgot-password", { email: f.email }, checkEmail(f.email), f.captchaToken),
372
384
  resetPassword: (f) => post("/reset-password", { token: f.token, password: f.password }, checkNewPassword(f.password)),