cauthy-auth 0.26.0 → 0.27.1

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
@@ -116,8 +116,8 @@ function fromWire(wire) {
116
116
  }
117
117
 
118
118
  // src/validate.ts
119
- var MIN_PASSWORD = 8;
120
- var MAX_PASSWORD = 256;
119
+ var MIN_PASSWORD = 12;
120
+ var MAX_PASSWORD = 128;
121
121
  var MAX_NAME = 120;
122
122
  var EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
123
123
  function checkEmail(value) {
@@ -376,7 +376,7 @@ function createAuthClient(options = {}) {
376
376
  signUp: {
377
377
  email: (f) => post(
378
378
  "/sign-up/email",
379
- { email: f.email, password: f.password, name: f.name, organization: f.organization },
379
+ { email: f.email, password: f.password, name: f.name, organization: f.organization, acceptLegal: f.acceptLegal, consents: f.consents },
380
380
  firstProblem(checkName(f.name), checkEmail(f.email), checkNewPassword(f.password), checkOrganization(f.organization)),
381
381
  f.captchaToken
382
382
  )
@@ -409,6 +409,12 @@ function createAuthClient(options = {}) {
409
409
  return body && typeof body.account === "object" ? body.account : null;
410
410
  },
411
411
  update: (f) => post("/me", { name: f.name }, checkName(f.name)),
412
+ async legal() {
413
+ const body = await read("/me/legal");
414
+ if (!body) return { ok: false, error: { code: "not_signed_in", message: "Nobody is signed in." } };
415
+ return { ok: true, status: "ok", pending: Array.isArray(body.pending) ? body.pending : [] };
416
+ },
417
+ acceptLegal: (f = {}) => post("/me/legal/accept", { kinds: f.kinds ?? [] }, null),
412
418
  changePassword: (f) => {
413
419
  const bad = checkNewPassword(f.newPassword);
414
420
  return post("/me/password", { password: f.password, newPassword: f.newPassword }, bad ? { ...bad, field: "newPassword" } : null);