strapi-identity 0.0.1-debug.3 → 0.0.2-debug.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.
@@ -2,7 +2,7 @@ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { useState, useEffect } from "react";
3
3
  import { W as WarningAlert } from "./WarningAlert-VU011LVF.mjs";
4
4
  import { Box, Flex, Typography, Grid, Button } from "@strapi/design-system";
5
- import { g as getTranslation } from "./index-BvKdbk8r.mjs";
5
+ import { g as getTranslation } from "./index-Dx9hSw6F.mjs";
6
6
  import { g as getToken } from "./tokenHelpers-DagDzpso.mjs";
7
7
  import { useIntl } from "react-intl";
8
8
  const AdminReset = ({ id }) => {
@@ -4,7 +4,7 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
5
  const WarningAlert = require("./WarningAlert-DFE5euMk.js");
6
6
  const designSystem = require("@strapi/design-system");
7
- const index = require("./index-hUfuPvh6.js");
7
+ const index = require("./index-CYdMQdCl.js");
8
8
  const tokenHelpers = require("./tokenHelpers-jtoRu0q5.js");
9
9
  const reactIntl = require("react-intl");
10
10
  const AdminReset = ({ id }) => {
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { useState, useEffect } from "react";
3
3
  import { Modal, Flex, Typography, Grid, Button, TextInput, Box, Field, Toggle } from "@strapi/design-system";
4
4
  import styled from "styled-components";
5
- import { g as getTranslation, I as InputOTP, a as InputOTPGroup, b as InputOTPSlot, c as InputOTPSeparator } from "./index-BvKdbk8r.mjs";
5
+ import { g as getTranslation, I as InputOTP, a as InputOTPGroup, b as InputOTPSlot, c as InputOTPSeparator } from "./index-Dx9hSw6F.mjs";
6
6
  import { QRCodeCanvas } from "qrcode.react";
7
7
  import { useIntl } from "react-intl";
8
8
  import { g as getToken } from "./tokenHelpers-DagDzpso.mjs";
@@ -308,7 +308,7 @@ const ProfileToggle = () => {
308
308
  ] })
309
309
  }
310
310
  ),
311
- uri && /* @__PURE__ */ jsx(
311
+ /* @__PURE__ */ jsx(
312
312
  ConfirmModal,
313
313
  {
314
314
  open: modalOpen,
@@ -4,7 +4,7 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
5
  const designSystem = require("@strapi/design-system");
6
6
  const styled = require("styled-components");
7
- const index = require("./index-hUfuPvh6.js");
7
+ const index = require("./index-CYdMQdCl.js");
8
8
  const qrcode_react = require("qrcode.react");
9
9
  const reactIntl = require("react-intl");
10
10
  const tokenHelpers = require("./tokenHelpers-jtoRu0q5.js");
@@ -312,7 +312,7 @@ const ProfileToggle = () => {
312
312
  ] })
313
313
  }
314
314
  ),
315
- uri && /* @__PURE__ */ jsxRuntime.jsx(
315
+ /* @__PURE__ */ jsxRuntime.jsx(
316
316
  ConfirmModal,
317
317
  {
318
318
  open: modalOpen,
@@ -6,7 +6,7 @@ const WarningAlert = require("./WarningAlert-DFE5euMk.js");
6
6
  const admin = require("@strapi/strapi/admin");
7
7
  const designSystem = require("@strapi/design-system");
8
8
  const icons = require("@strapi/icons");
9
- const index = require("./index-hUfuPvh6.js");
9
+ const index = require("./index-CYdMQdCl.js");
10
10
  const tokenHelpers = require("./tokenHelpers-jtoRu0q5.js");
11
11
  const reactIntl = require("react-intl");
12
12
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
@@ -4,7 +4,7 @@ import { W as WarningAlert } from "./WarningAlert-VU011LVF.mjs";
4
4
  import { useNotification, Page, Layouts } from "@strapi/strapi/admin";
5
5
  import { Button, Flex, Typography, Grid, Field, Toggle, TextInput } from "@strapi/design-system";
6
6
  import { Check } from "@strapi/icons";
7
- import { g as getTranslation } from "./index-BvKdbk8r.mjs";
7
+ import { g as getTranslation } from "./index-Dx9hSw6F.mjs";
8
8
  import { g as getToken } from "./tokenHelpers-DagDzpso.mjs";
9
9
  import { useIntl } from "react-intl";
10
10
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
@@ -1391,7 +1391,7 @@ const plugin = {
1391
1391
  },
1392
1392
  id: "strapi-identity-settings",
1393
1393
  to: `/settings/${PLUGIN_ID}`,
1394
- Component: async () => Promise.resolve().then(() => require("./SettingsPage-CQ3rVHCt.js")),
1394
+ Component: async () => Promise.resolve().then(() => require("./SettingsPage-b1nrDzRV.js")),
1395
1395
  permissions: [
1396
1396
  { action: "plugin::strapi-identity.settings.read" },
1397
1397
  { action: "plugin::strapi-identity.settings.read" }
@@ -1403,13 +1403,13 @@ const plugin = {
1403
1403
  id: "profile-toggle",
1404
1404
  route: "/admin/me",
1405
1405
  selector: '#main-content form[method="put"] > :nth-child(2) > div > div > div:nth-child(2)',
1406
- Component: async () => Promise.resolve().then(() => require("./ProfileToggle-B3YU4UtR.js"))
1406
+ Component: async () => Promise.resolve().then(() => require("./ProfileToggle-CsKhueBz.js"))
1407
1407
  });
1408
1408
  injections.registerRoute({
1409
1409
  id: "admin-reset",
1410
1410
  route: "/admin/settings/users/:id",
1411
1411
  selector: '#main-content form[method="put"] > :nth-child(2) > div > div:nth-child(2)',
1412
- Component: async () => Promise.resolve().then(() => require("./AdminReset-CA0e8mrS.js"))
1412
+ Component: async () => Promise.resolve().then(() => require("./AdminReset-DOOd1ZBT.js"))
1413
1413
  });
1414
1414
  InjectVerify(app);
1415
1415
  },
@@ -1371,7 +1371,7 @@ const plugin = {
1371
1371
  },
1372
1372
  id: "strapi-identity-settings",
1373
1373
  to: `/settings/${PLUGIN_ID}`,
1374
- Component: async () => import("./SettingsPage-B_NnQtcX.mjs"),
1374
+ Component: async () => import("./SettingsPage-mmaTI4X1.mjs"),
1375
1375
  permissions: [
1376
1376
  { action: "plugin::strapi-identity.settings.read" },
1377
1377
  { action: "plugin::strapi-identity.settings.read" }
@@ -1383,13 +1383,13 @@ const plugin = {
1383
1383
  id: "profile-toggle",
1384
1384
  route: "/admin/me",
1385
1385
  selector: '#main-content form[method="put"] > :nth-child(2) > div > div > div:nth-child(2)',
1386
- Component: async () => import("./ProfileToggle-CEFuZ3yP.mjs")
1386
+ Component: async () => import("./ProfileToggle-BWTNE6w1.mjs")
1387
1387
  });
1388
1388
  injections.registerRoute({
1389
1389
  id: "admin-reset",
1390
1390
  route: "/admin/settings/users/:id",
1391
1391
  selector: '#main-content form[method="put"] > :nth-child(2) > div > div:nth-child(2)',
1392
- Component: async () => import("./AdminReset-BZV-zGKx.mjs")
1392
+ Component: async () => import("./AdminReset-C7Wbxz4Z.mjs")
1393
1393
  });
1394
1394
  InjectVerify(app);
1395
1395
  },
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
- const index = require("../_chunks/index-hUfuPvh6.js");
2
+ const index = require("../_chunks/index-CYdMQdCl.js");
3
3
  require("strapi-admin-portal");
4
4
  module.exports = index.plugin;
@@ -1,4 +1,4 @@
1
- import { p } from "../_chunks/index-BvKdbk8r.mjs";
1
+ import { p } from "../_chunks/index-Dx9hSw6F.mjs";
2
2
  import "strapi-admin-portal";
3
3
  export {
4
4
  p as default
@@ -9074,15 +9074,11 @@ const jwt = /* @__PURE__ */ getDefaultExportFromCjs(jsonwebtokenExports);
9074
9074
  const register = ({ strapi: strapi2 }) => {
9075
9075
  const adminPlugin = strapi2.admin;
9076
9076
  const secret2 = strapi2.config.get("admin.auth.secret");
9077
- const configuredSecure = strapi2.config.get("admin.auth.cookie.secure");
9078
- const isProduction = process.env.NODE_ENV === "production";
9079
- const isSecure = typeof configuredSecure === "boolean" ? configuredSecure : isProduction;
9080
9077
  const domain = strapi2.config.get("admin.auth.domain");
9081
- const cookieOptions = { httpOnly: false, secure: isSecure, overwrite: true, domain };
9082
9078
  const loginRoute = adminPlugin.routes.admin.routes.find(
9083
9079
  ({ method, path }) => method === "POST" && path === "/login"
9084
9080
  );
9085
- if (loginRoute) replaceLogin(loginRoute, secret2, cookieOptions);
9081
+ if (loginRoute) replaceLogin(loginRoute, secret2, domain);
9086
9082
  strapi2.server.use(async (ctx, next) => {
9087
9083
  const mfaCookie = ctx.cookies.get("strapi_admin_mfa");
9088
9084
  if (mfaCookie && ctx.path.startsWith("/admin/auth")) {
@@ -9097,7 +9093,7 @@ const register = ({ strapi: strapi2 }) => {
9097
9093
  await next();
9098
9094
  });
9099
9095
  };
9100
- const replaceLogin = (route2, secret2, cookieOptions) => {
9096
+ const replaceLogin = (route2, secret2, domain) => {
9101
9097
  route2.config.middlewares = route2.config.middlewares || [];
9102
9098
  route2.config.middlewares.push(async (ctx, next) => {
9103
9099
  const { deviceId, rememberMe } = ctx.request.body;
@@ -9115,7 +9111,13 @@ const replaceLogin = (route2, secret2, cookieOptions) => {
9115
9111
  const newPayload = { userId: payload.userId, deviceId, rememberMe, type: "mfa" };
9116
9112
  const newToken = jwt.sign(newPayload, secret2, { expiresIn: "5m" });
9117
9113
  const expires = new Date(Date.now() + 5 * 60 * 1e3);
9118
- ctx.cookies.set("strapi_admin_mfa", newToken, { ...cookieOptions, expires });
9114
+ ctx.cookies.set("strapi_admin_mfa", newToken, {
9115
+ domain,
9116
+ httpOnly: false,
9117
+ overwrite: true,
9118
+ secure: ctx.request.secure,
9119
+ expires
9120
+ });
9119
9121
  ctx.body.data = { data: {}, error: null };
9120
9122
  });
9121
9123
  };
@@ -9068,15 +9068,11 @@ const jwt = /* @__PURE__ */ getDefaultExportFromCjs(jsonwebtokenExports);
9068
9068
  const register = ({ strapi: strapi2 }) => {
9069
9069
  const adminPlugin = strapi2.admin;
9070
9070
  const secret2 = strapi2.config.get("admin.auth.secret");
9071
- const configuredSecure = strapi2.config.get("admin.auth.cookie.secure");
9072
- const isProduction = process.env.NODE_ENV === "production";
9073
- const isSecure = typeof configuredSecure === "boolean" ? configuredSecure : isProduction;
9074
9071
  const domain = strapi2.config.get("admin.auth.domain");
9075
- const cookieOptions = { httpOnly: false, secure: isSecure, overwrite: true, domain };
9076
9072
  const loginRoute = adminPlugin.routes.admin.routes.find(
9077
9073
  ({ method, path }) => method === "POST" && path === "/login"
9078
9074
  );
9079
- if (loginRoute) replaceLogin(loginRoute, secret2, cookieOptions);
9075
+ if (loginRoute) replaceLogin(loginRoute, secret2, domain);
9080
9076
  strapi2.server.use(async (ctx, next) => {
9081
9077
  const mfaCookie = ctx.cookies.get("strapi_admin_mfa");
9082
9078
  if (mfaCookie && ctx.path.startsWith("/admin/auth")) {
@@ -9091,7 +9087,7 @@ const register = ({ strapi: strapi2 }) => {
9091
9087
  await next();
9092
9088
  });
9093
9089
  };
9094
- const replaceLogin = (route2, secret2, cookieOptions) => {
9090
+ const replaceLogin = (route2, secret2, domain) => {
9095
9091
  route2.config.middlewares = route2.config.middlewares || [];
9096
9092
  route2.config.middlewares.push(async (ctx, next) => {
9097
9093
  const { deviceId, rememberMe } = ctx.request.body;
@@ -9109,7 +9105,13 @@ const replaceLogin = (route2, secret2, cookieOptions) => {
9109
9105
  const newPayload = { userId: payload.userId, deviceId, rememberMe, type: "mfa" };
9110
9106
  const newToken = jwt.sign(newPayload, secret2, { expiresIn: "5m" });
9111
9107
  const expires = new Date(Date.now() + 5 * 60 * 1e3);
9112
- ctx.cookies.set("strapi_admin_mfa", newToken, { ...cookieOptions, expires });
9108
+ ctx.cookies.set("strapi_admin_mfa", newToken, {
9109
+ domain,
9110
+ httpOnly: false,
9111
+ overwrite: true,
9112
+ secure: ctx.request.secure,
9113
+ expires
9114
+ });
9113
9115
  ctx.body.data = { data: {}, error: null };
9114
9116
  });
9115
9117
  };
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.1-debug.3",
2
+ "version": "0.0.2-debug.0",
3
3
  "keywords": [
4
4
  "strapi",
5
5
  "plugin",