strapi-identity 0.6.1 → 0.7.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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Detailed Multi-Factor Authentication (MFA) plugin for Strapi v5+. Secure your Strapi Admin panel with TOTP-based 2FA, fully integrated into the Strapi interface.
4
4
 
5
- ![verification screen](./screenshots/login-verification.webp)
5
+ ![verification screen](https://raw.githubusercontent.com/Link2Twenty/strapi-identity/refs/heads/main/screenshots/login-verification.webp)
6
6
 
7
7
  ## Features
8
8
 
@@ -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 getToken, a as getTranslation } from "./index-D1Rr9LMh.mjs";
5
+ import { g as getToken, a as getTranslation } from "./index-BGCzWKE5.mjs";
6
6
  import { useIntl } from "react-intl";
7
7
  const AdminReset = ({ id }) => {
8
8
  const { formatMessage } = useIntl();
@@ -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-CHIUAjKH.js");
7
+ const index = require("./index-Z7ZoOcpL.js");
8
8
  const reactIntl = require("react-intl");
9
9
  const AdminReset = ({ id }) => {
10
10
  const { formatMessage } = reactIntl.useIntl();
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
5
  const designSystem = require("@strapi/design-system");
6
- const index = require("./index-CHIUAjKH.js");
6
+ const index = require("./index-Z7ZoOcpL.js");
7
7
  const reactIntl = require("react-intl");
8
8
  function RemoveModal({ open, onOpenChange, onSubmit }) {
9
9
  const { formatMessage } = reactIntl.useIntl();
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { useState, useEffect } from "react";
3
3
  import { Modal, Flex, Typography, TextInput, Button, Box, Grid, Field, Toggle } from "@strapi/design-system";
4
- import { a as getTranslation, I as InputOTP, b as InputOTPGroup, c as InputOTPSlot, d as InputOTPSeparator, g as getToken, C as ConfirmModal, E as EmailOTPModal } from "./index-D1Rr9LMh.mjs";
4
+ import { a as getTranslation, I as InputOTP, b as InputOTPGroup, c as InputOTPSlot, d as InputOTPSeparator, g as getToken, C as ConfirmModal, E as EmailOTPModal } from "./index-BGCzWKE5.mjs";
5
5
  import { useIntl } from "react-intl";
6
6
  function RemoveModal({ open, onOpenChange, onSubmit }) {
7
7
  const { formatMessage } = useIntl();
@@ -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-CHIUAjKH.js");
9
+ const index = require("./index-Z7ZoOcpL.js");
10
10
  const reactIntl = require("react-intl");
11
11
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
12
12
  var lodash$1 = { exports: {} };
@@ -23,12 +23,12 @@ var hasRequiredLodash;
23
23
  function requireLodash() {
24
24
  if (hasRequiredLodash) return lodash$1.exports;
25
25
  hasRequiredLodash = 1;
26
- (function(module2, exports$1) {
26
+ (function(module2, exports2) {
27
27
  (function() {
28
28
  var undefined$1;
29
- var VERSION = "4.17.23";
29
+ var VERSION = "4.18.1";
30
30
  var LARGE_ARRAY_SIZE = 200;
31
- var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
31
+ var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`", INVALID_TEMPL_IMPORTS_ERROR_TEXT = "Invalid `imports` option passed into `_.template`";
32
32
  var HASH_UNDEFINED = "__lodash_hash_undefined__";
33
33
  var MAX_MEMOIZE_SIZE = 500;
34
34
  var PLACEHOLDER = "__lodash_placeholder__";
@@ -351,7 +351,7 @@ function requireLodash() {
351
351
  var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
352
352
  var freeSelf = typeof self == "object" && self && self.Object === Object && self;
353
353
  var root = freeGlobal || freeSelf || Function("return this")();
354
- var freeExports = exports$1 && !exports$1.nodeType && exports$1;
354
+ var freeExports = exports2 && !exports2.nodeType && exports2;
355
355
  var freeModule = freeExports && true && module2 && !module2.nodeType && module2;
356
356
  var moduleExports = freeModule && freeModule.exports === freeExports;
357
357
  var freeProcess = moduleExports && freeGlobal.process;
@@ -1958,19 +1958,12 @@ function requireLodash() {
1958
1958
  if (!length) {
1959
1959
  return true;
1960
1960
  }
1961
- var isRootPrimitive = object == null || typeof object !== "object" && typeof object !== "function";
1962
1961
  while (++index2 < length) {
1963
- var key = path[index2];
1964
- if (typeof key !== "string") {
1965
- continue;
1966
- }
1962
+ var key = toKey(path[index2]);
1967
1963
  if (key === "__proto__" && !hasOwnProperty.call(object, "__proto__")) {
1968
1964
  return false;
1969
1965
  }
1970
- if (key === "constructor" && index2 + 1 < length && typeof path[index2 + 1] === "string" && path[index2 + 1] === "prototype") {
1971
- if (isRootPrimitive && index2 === 0) {
1972
- continue;
1973
- }
1966
+ if ((key === "constructor" || key === "prototype") && index2 < length - 1) {
1974
1967
  return false;
1975
1968
  }
1976
1969
  }
@@ -3302,7 +3295,7 @@ function requireLodash() {
3302
3295
  var index2 = -1, length = pairs == null ? 0 : pairs.length, result2 = {};
3303
3296
  while (++index2 < length) {
3304
3297
  var pair = pairs[index2];
3305
- result2[pair[0]] = pair[1];
3298
+ baseAssignValue(result2, pair[0], pair[1]);
3306
3299
  }
3307
3300
  return result2;
3308
3301
  }
@@ -4686,8 +4679,13 @@ function requireLodash() {
4686
4679
  options = undefined$1;
4687
4680
  }
4688
4681
  string = toString(string);
4689
- options = assignInWith({}, options, settings, customDefaultsAssignIn);
4690
- var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
4682
+ options = assignWith({}, options, settings, customDefaultsAssignIn);
4683
+ var imports = assignWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
4684
+ arrayEach(importsKeys, function(key) {
4685
+ if (reForbiddenIdentifierChars.test(key)) {
4686
+ throw new Error2(INVALID_TEMPL_IMPORTS_ERROR_TEXT);
4687
+ }
4688
+ });
4691
4689
  var isEscaping, isEvaluating, index2 = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
4692
4690
  var reDelimiters = RegExp2(
4693
4691
  (options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$",
@@ -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, Textarea } from "@strapi/design-system";
6
6
  import { Check } from "@strapi/icons";
7
- import { g as getToken, a as getTranslation } from "./index-D1Rr9LMh.mjs";
7
+ import { g as getToken, a as getTranslation } from "./index-BGCzWKE5.mjs";
8
8
  import { useIntl } from "react-intl";
9
9
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
10
10
  var lodash$1 = { exports: {} };
@@ -21,12 +21,12 @@ var hasRequiredLodash;
21
21
  function requireLodash() {
22
22
  if (hasRequiredLodash) return lodash$1.exports;
23
23
  hasRequiredLodash = 1;
24
- (function(module, exports$1) {
24
+ (function(module, exports) {
25
25
  (function() {
26
26
  var undefined$1;
27
- var VERSION = "4.17.23";
27
+ var VERSION = "4.18.1";
28
28
  var LARGE_ARRAY_SIZE = 200;
29
- var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
29
+ var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`", INVALID_TEMPL_IMPORTS_ERROR_TEXT = "Invalid `imports` option passed into `_.template`";
30
30
  var HASH_UNDEFINED = "__lodash_hash_undefined__";
31
31
  var MAX_MEMOIZE_SIZE = 500;
32
32
  var PLACEHOLDER = "__lodash_placeholder__";
@@ -349,7 +349,7 @@ function requireLodash() {
349
349
  var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
350
350
  var freeSelf = typeof self == "object" && self && self.Object === Object && self;
351
351
  var root = freeGlobal || freeSelf || Function("return this")();
352
- var freeExports = exports$1 && !exports$1.nodeType && exports$1;
352
+ var freeExports = exports && !exports.nodeType && exports;
353
353
  var freeModule = freeExports && true && module && !module.nodeType && module;
354
354
  var moduleExports = freeModule && freeModule.exports === freeExports;
355
355
  var freeProcess = moduleExports && freeGlobal.process;
@@ -1956,19 +1956,12 @@ function requireLodash() {
1956
1956
  if (!length) {
1957
1957
  return true;
1958
1958
  }
1959
- var isRootPrimitive = object == null || typeof object !== "object" && typeof object !== "function";
1960
1959
  while (++index < length) {
1961
- var key = path[index];
1962
- if (typeof key !== "string") {
1963
- continue;
1964
- }
1960
+ var key = toKey(path[index]);
1965
1961
  if (key === "__proto__" && !hasOwnProperty.call(object, "__proto__")) {
1966
1962
  return false;
1967
1963
  }
1968
- if (key === "constructor" && index + 1 < length && typeof path[index + 1] === "string" && path[index + 1] === "prototype") {
1969
- if (isRootPrimitive && index === 0) {
1970
- continue;
1971
- }
1964
+ if ((key === "constructor" || key === "prototype") && index < length - 1) {
1972
1965
  return false;
1973
1966
  }
1974
1967
  }
@@ -3300,7 +3293,7 @@ function requireLodash() {
3300
3293
  var index = -1, length = pairs == null ? 0 : pairs.length, result2 = {};
3301
3294
  while (++index < length) {
3302
3295
  var pair = pairs[index];
3303
- result2[pair[0]] = pair[1];
3296
+ baseAssignValue(result2, pair[0], pair[1]);
3304
3297
  }
3305
3298
  return result2;
3306
3299
  }
@@ -4684,8 +4677,13 @@ function requireLodash() {
4684
4677
  options = undefined$1;
4685
4678
  }
4686
4679
  string = toString(string);
4687
- options = assignInWith({}, options, settings, customDefaultsAssignIn);
4688
- var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
4680
+ options = assignWith({}, options, settings, customDefaultsAssignIn);
4681
+ var imports = assignWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
4682
+ arrayEach(importsKeys, function(key) {
4683
+ if (reForbiddenIdentifierChars.test(key)) {
4684
+ throw new Error2(INVALID_TEMPL_IMPORTS_ERROR_TEXT);
4685
+ }
4686
+ });
4689
4687
  var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
4690
4688
  var reDelimiters = RegExp2(
4691
4689
  (options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$",
@@ -1580,6 +1580,9 @@ const Rule = styled.hr`
1580
1580
  border: 0;
1581
1581
  background-color: #e5e5e5;
1582
1582
  `;
1583
+ const getCookieName = () => {
1584
+ return process?.env?.STRAPI_ADMIN_AUTH_COOKIE_NAME || "jwtToken";
1585
+ };
1583
1586
  const getCookieValue = (name) => {
1584
1587
  const cookieArray = document.cookie.split(";");
1585
1588
  return cookieArray.reduce((result, cookie) => {
@@ -1588,9 +1591,10 @@ const getCookieValue = (name) => {
1588
1591
  }, null);
1589
1592
  };
1590
1593
  const getToken = () => {
1591
- const fromLocalStorage = localStorage.getItem("jwtToken");
1594
+ const tokenName = getCookieName();
1595
+ const fromLocalStorage = localStorage.getItem(tokenName);
1592
1596
  if (fromLocalStorage) return JSON.parse(fromLocalStorage);
1593
- const fromCookie = getCookieValue("jwtToken");
1597
+ const fromCookie = getCookieValue(tokenName);
1594
1598
  return fromCookie ?? null;
1595
1599
  };
1596
1600
  function EmailOTPModal({
@@ -1949,7 +1953,7 @@ const plugin = {
1949
1953
  },
1950
1954
  id: "strapi-identity-settings",
1951
1955
  to: `/${PLUGIN_ID}`,
1952
- Component: () => import("./SettingsPage-DWuVgPPr.mjs"),
1956
+ Component: () => import("./SettingsPage-DhdlOuM4.mjs"),
1953
1957
  permissions: [{ action: "plugin::strapi-identity.settings.update" }]
1954
1958
  });
1955
1959
  app.addMiddlewares([mfaRedirect]);
@@ -1958,14 +1962,14 @@ const plugin = {
1958
1962
  id: "profile-toggle",
1959
1963
  route: "/admin/me",
1960
1964
  selector: '#main-content form[method="put"] > :nth-child(2) > div > div > div:nth-child(2)',
1961
- Component: () => import("./ProfileToggle-C5glSkS5.mjs")
1965
+ Component: () => import("./ProfileToggle-U8uYHOxp.mjs")
1962
1966
  });
1963
1967
  injections.registerRoute({
1964
1968
  id: "admin-reset",
1965
1969
  route: "/admin/settings/users/:id",
1966
1970
  selector: '#main-content form[method="put"] > :nth-child(2) > div > div:nth-child(2)',
1967
1971
  permissions: [{ action: "plugin::strapi-identity.settings.update" }],
1968
- Component: () => import("./AdminReset-DzpiB_dK.mjs")
1972
+ Component: () => import("./AdminReset-C8tJMMQS.mjs")
1969
1973
  });
1970
1974
  InjectVerify(app);
1971
1975
  InjectEnforced(app);
@@ -1600,6 +1600,9 @@ const Rule = styled__default.default.hr`
1600
1600
  border: 0;
1601
1601
  background-color: #e5e5e5;
1602
1602
  `;
1603
+ const getCookieName = () => {
1604
+ return process?.env?.STRAPI_ADMIN_AUTH_COOKIE_NAME || "jwtToken";
1605
+ };
1603
1606
  const getCookieValue = (name) => {
1604
1607
  const cookieArray = document.cookie.split(";");
1605
1608
  return cookieArray.reduce((result, cookie) => {
@@ -1608,9 +1611,10 @@ const getCookieValue = (name) => {
1608
1611
  }, null);
1609
1612
  };
1610
1613
  const getToken = () => {
1611
- const fromLocalStorage = localStorage.getItem("jwtToken");
1614
+ const tokenName = getCookieName();
1615
+ const fromLocalStorage = localStorage.getItem(tokenName);
1612
1616
  if (fromLocalStorage) return JSON.parse(fromLocalStorage);
1613
- const fromCookie = getCookieValue("jwtToken");
1617
+ const fromCookie = getCookieValue(tokenName);
1614
1618
  return fromCookie ?? null;
1615
1619
  };
1616
1620
  function EmailOTPModal({
@@ -1969,7 +1973,7 @@ const plugin = {
1969
1973
  },
1970
1974
  id: "strapi-identity-settings",
1971
1975
  to: `/${PLUGIN_ID}`,
1972
- Component: () => Promise.resolve().then(() => require("./SettingsPage-ehAdX5ev.js")),
1976
+ Component: () => Promise.resolve().then(() => require("./SettingsPage-CZJeoZM-.js")),
1973
1977
  permissions: [{ action: "plugin::strapi-identity.settings.update" }]
1974
1978
  });
1975
1979
  app.addMiddlewares([mfaRedirect]);
@@ -1978,14 +1982,14 @@ const plugin = {
1978
1982
  id: "profile-toggle",
1979
1983
  route: "/admin/me",
1980
1984
  selector: '#main-content form[method="put"] > :nth-child(2) > div > div > div:nth-child(2)',
1981
- Component: () => Promise.resolve().then(() => require("./ProfileToggle-DqOHS9Xv.js"))
1985
+ Component: () => Promise.resolve().then(() => require("./ProfileToggle-DAWXMfz9.js"))
1982
1986
  });
1983
1987
  injections.registerRoute({
1984
1988
  id: "admin-reset",
1985
1989
  route: "/admin/settings/users/:id",
1986
1990
  selector: '#main-content form[method="put"] > :nth-child(2) > div > div:nth-child(2)',
1987
1991
  permissions: [{ action: "plugin::strapi-identity.settings.update" }],
1988
- Component: () => Promise.resolve().then(() => require("./AdminReset-LoJC7kqo.js"))
1992
+ Component: () => Promise.resolve().then(() => require("./AdminReset-CB9VgfLp.js"))
1989
1993
  });
1990
1994
  InjectVerify(app);
1991
1995
  InjectEnforced(app);
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const index = require("./index-CHIUAjKH.js");
3
+ const index = require("./index-Z7ZoOcpL.js");
4
4
  require("strapi-admin-portal");
5
5
  exports.default = index.plugin;
@@ -1,4 +1,4 @@
1
- import { p } from "./index-D1Rr9LMh.mjs";
1
+ import { p } from "./index-BGCzWKE5.mjs";
2
2
  import "strapi-admin-portal";
3
3
  export {
4
4
  p as default
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Retrieves the name of the cookie used for authentication.
3
+ * @returns The name of the authentication cookie.
4
+ */
5
+ export declare const getCookieName: () => string;
1
6
  /**
2
7
  * Retrieves the value of a specified cookie.
3
8
  *