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/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." };
@@ -253,6 +260,7 @@ function createAuthClient(options = {}) {
253
260
  mfa: (f) => post("/sign-in/mfa", { code: f.code }, checkCode(f.code)),
254
261
  mfaMethods: () => post("/sign-in/mfa/methods", {}, null),
255
262
  mfaSendCode: () => post("/sign-in/mfa/send", {}, null),
263
+ mfaSendEmail: () => post("/sign-in/mfa/email", {}, null),
256
264
  mfaPush: () => post("/sign-in/mfa/push", {}, null),
257
265
  async mfaPushWait(o = {}) {
258
266
  const status = await new Promise((resolve) => {
@@ -369,7 +377,12 @@ function createAuthClient(options = {}) {
369
377
  }
370
378
  },
371
379
  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)
380
+ email: (f) => post(
381
+ "/sign-up/email",
382
+ { email: f.email, password: f.password, name: f.name, organization: f.organization },
383
+ firstProblem(checkName(f.name), checkEmail(f.email), checkNewPassword(f.password), checkOrganization(f.organization)),
384
+ f.captchaToken
385
+ )
373
386
  },
374
387
  forgotPassword: (f) => post("/forgot-password", { email: f.email }, checkEmail(f.email), f.captchaToken),
375
388
  resetPassword: (f) => post("/reset-password", { token: f.token, password: f.password }, checkNewPassword(f.password)),