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