@opengis/fastify-table 2.4.14 → 2.4.15

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.
@@ -1 +1 @@
1
- {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../../../../server/routes/auth/controllers/2factor/verify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AA2BvC;;;;;;;;;;;;;;;;GAgBG;AAEH,wBAA8B,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,kBA2DzE"}
1
+ {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../../../../server/routes/auth/controllers/2factor/verify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AA2BvC;;;;;;;;;;;;;;;;GAgBG;AAEH,wBAA8B,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,kBA6DzE"}
@@ -31,9 +31,9 @@ const defaultPt = existsSync(path.join(dirname, `../../../../templates/pt/${temp
31
31
  * @returns {String} redirect Шлях до переадресації
32
32
  */
33
33
  export default async function verifyFunction(req, reply) {
34
- const { pg = pgClients.client, user = {}, body = {} } = req;
34
+ const code = req.method === "POST" ? req.body?.code : req.query?.code;
35
+ const { pg = pgClients.client, user = {} } = req;
35
36
  const { uid, twofa, email } = user || {};
36
- const { code } = body;
37
37
  if (!twofa) {
38
38
  throw BadRequestError("2fa not enabled");
39
39
  }
@@ -41,7 +41,7 @@ export default async function verifyFunction(req, reply) {
41
41
  throw Error("empty pg");
42
42
  }
43
43
  if (!code) {
44
- throw BadRequestError("not enough body params: code");
44
+ throw BadRequestError(`not enough ${req.method === "POST" ? "body" : "query"} params: code`);
45
45
  }
46
46
  const { enabled } = await verify({ uid, code, pg });
47
47
  await enableSecret({ pg, uid });
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/routes/auth/index.ts"],"names":[],"mappings":"AA+CA,iBAAS,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,GAAE,GAAQ,QA4FtC;AAED,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/routes/auth/index.ts"],"names":[],"mappings":"AA+CA,iBAAS,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,GAAE,GAAQ,QA+FtC;AAED,eAAe,MAAM,CAAC"}
@@ -56,6 +56,9 @@ function plugin(app, opt = {}) {
56
56
  }
57
57
  // 2factor
58
58
  if (!app.hasRoute({ method: "GET", url: "/2factor/verify" })) {
59
+ app.get("/2factor/verify", params, verify);
60
+ }
61
+ if (!app.hasRoute({ method: "POST", url: "/2factor/verify" })) {
59
62
  app.post("/2factor/verify", params, verify);
60
63
  }
61
64
  if (!app.hasRoute({ method: "POST", url: "/2factor/recovery" })) {
@@ -65,9 +65,9 @@
65
65
  Enter the 2-step verification code from your authenticator app.
66
66
  </p>
67
67
 
68
- <form action="/2factor/verify" method="post">
68
+ <form action="/2factor/verify" method="get">
69
69
  <div class="space-y-5">
70
- <div>
70
+ <div>
71
71
  <input type="text" name="code" class="form-input hidden">
72
72
  <div class="space-y-5">
73
73
  <div class="my-3 flex gap-x-2" data-hs-pin-input>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "2.4.14",
3
+ "version": "2.4.15",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [