strapi-identity 0.5.1 → 0.6.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.
@@ -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-Bm3H4z3W.mjs";
5
+ import { g as getToken, a as getTranslation } from "./index-D1Rr9LMh.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-Ce4QOU6Y.js");
7
+ const index = require("./index-CHIUAjKH.js");
8
8
  const reactIntl = require("react-intl");
9
9
  const AdminReset = ({ id }) => {
10
10
  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-Bm3H4z3W.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-D1Rr9LMh.mjs";
5
5
  import { useIntl } from "react-intl";
6
6
  function RemoveModal({ open, onOpenChange, onSubmit }) {
7
7
  const { formatMessage } = 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-Ce4QOU6Y.js");
6
+ const index = require("./index-CHIUAjKH.js");
7
7
  const reactIntl = require("react-intl");
8
8
  function RemoveModal({ open, onOpenChange, onSubmit }) {
9
9
  const { formatMessage } = reactIntl.useIntl();
@@ -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-Bm3H4z3W.mjs";
7
+ import { g as getToken, a as getTranslation } from "./index-D1Rr9LMh.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: {} };
@@ -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-Ce4QOU6Y.js");
9
+ const index = require("./index-CHIUAjKH.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: {} };
@@ -1348,6 +1348,7 @@ const Logo = ({ fallbackIcon }) => {
1348
1348
  };
1349
1349
  const VerifyPage = ({ fallbackIcon }) => {
1350
1350
  const auth = admin.useAuth("MFA", (auth2) => auth2);
1351
+ const dispatch = useDispatch();
1351
1352
  const { formatMessage } = reactIntl.useIntl();
1352
1353
  const [error, setError] = React.useState(null);
1353
1354
  const [useRecoveryCode, setUseRecoveryCode] = React.useState(false);
@@ -1370,9 +1371,8 @@ const VerifyPage = ({ fallbackIcon }) => {
1370
1371
  `${response.status} ${response.statusText}: ${data.error || "Unknown error"}`
1371
1372
  );
1372
1373
  }
1373
- const rawTarget = new URLSearchParams(window.location.search).get("redirectTo") || "/admin";
1374
- const target = /^\/[^/]/.test(rawTarget) ? rawTarget : "/admin";
1375
- window.location.replace(target);
1374
+ const { token, rememberMe } = data.data;
1375
+ dispatch({ type: "admin/login", payload: { token, persist: rememberMe } });
1376
1376
  } catch (error2) {
1377
1377
  setError(
1378
1378
  formatMessage({
@@ -1969,7 +1969,7 @@ const plugin = {
1969
1969
  },
1970
1970
  id: "strapi-identity-settings",
1971
1971
  to: `/${PLUGIN_ID}`,
1972
- Component: () => Promise.resolve().then(() => require("./SettingsPage-DZDW9kNI.js")),
1972
+ Component: () => Promise.resolve().then(() => require("./SettingsPage-ehAdX5ev.js")),
1973
1973
  permissions: [{ action: "plugin::strapi-identity.settings.update" }]
1974
1974
  });
1975
1975
  app.addMiddlewares([mfaRedirect]);
@@ -1978,14 +1978,14 @@ const plugin = {
1978
1978
  id: "profile-toggle",
1979
1979
  route: "/admin/me",
1980
1980
  selector: '#main-content form[method="put"] > :nth-child(2) > div > div > div:nth-child(2)',
1981
- Component: () => Promise.resolve().then(() => require("./ProfileToggle-4u6WWddz.js"))
1981
+ Component: () => Promise.resolve().then(() => require("./ProfileToggle-DqOHS9Xv.js"))
1982
1982
  });
1983
1983
  injections.registerRoute({
1984
1984
  id: "admin-reset",
1985
1985
  route: "/admin/settings/users/:id",
1986
1986
  selector: '#main-content form[method="put"] > :nth-child(2) > div > div:nth-child(2)',
1987
1987
  permissions: [{ action: "plugin::strapi-identity.settings.update" }],
1988
- Component: () => Promise.resolve().then(() => require("./AdminReset-DsKz040S.js"))
1988
+ Component: () => Promise.resolve().then(() => require("./AdminReset-LoJC7kqo.js"))
1989
1989
  });
1990
1990
  InjectVerify(app);
1991
1991
  InjectEnforced(app);
@@ -1328,6 +1328,7 @@ const Logo = ({ fallbackIcon }) => {
1328
1328
  };
1329
1329
  const VerifyPage = ({ fallbackIcon }) => {
1330
1330
  const auth = useAuth("MFA", (auth2) => auth2);
1331
+ const dispatch = useDispatch();
1331
1332
  const { formatMessage } = useIntl();
1332
1333
  const [error, setError] = useState(null);
1333
1334
  const [useRecoveryCode, setUseRecoveryCode] = useState(false);
@@ -1350,9 +1351,8 @@ const VerifyPage = ({ fallbackIcon }) => {
1350
1351
  `${response.status} ${response.statusText}: ${data.error || "Unknown error"}`
1351
1352
  );
1352
1353
  }
1353
- const rawTarget = new URLSearchParams(window.location.search).get("redirectTo") || "/admin";
1354
- const target = /^\/[^/]/.test(rawTarget) ? rawTarget : "/admin";
1355
- window.location.replace(target);
1354
+ const { token, rememberMe } = data.data;
1355
+ dispatch({ type: "admin/login", payload: { token, persist: rememberMe } });
1356
1356
  } catch (error2) {
1357
1357
  setError(
1358
1358
  formatMessage({
@@ -1949,7 +1949,7 @@ const plugin = {
1949
1949
  },
1950
1950
  id: "strapi-identity-settings",
1951
1951
  to: `/${PLUGIN_ID}`,
1952
- Component: () => import("./SettingsPage-CcHTu8-f.mjs"),
1952
+ Component: () => import("./SettingsPage-DWuVgPPr.mjs"),
1953
1953
  permissions: [{ action: "plugin::strapi-identity.settings.update" }]
1954
1954
  });
1955
1955
  app.addMiddlewares([mfaRedirect]);
@@ -1958,14 +1958,14 @@ const plugin = {
1958
1958
  id: "profile-toggle",
1959
1959
  route: "/admin/me",
1960
1960
  selector: '#main-content form[method="put"] > :nth-child(2) > div > div > div:nth-child(2)',
1961
- Component: () => import("./ProfileToggle-B1UK1opI.mjs")
1961
+ Component: () => import("./ProfileToggle-C5glSkS5.mjs")
1962
1962
  });
1963
1963
  injections.registerRoute({
1964
1964
  id: "admin-reset",
1965
1965
  route: "/admin/settings/users/:id",
1966
1966
  selector: '#main-content form[method="put"] > :nth-child(2) > div > div:nth-child(2)',
1967
1967
  permissions: [{ action: "plugin::strapi-identity.settings.update" }],
1968
- Component: () => import("./AdminReset-DjVX7phX.mjs")
1968
+ Component: () => import("./AdminReset-DzpiB_dK.mjs")
1969
1969
  });
1970
1970
  InjectVerify(app);
1971
1971
  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-Ce4QOU6Y.js");
3
+ const index = require("./index-CHIUAjKH.js");
4
4
  require("strapi-admin-portal");
5
5
  exports.default = index.plugin;
@@ -1,4 +1,4 @@
1
- import { p } from "./index-Bm3H4z3W.mjs";
1
+ import { p } from "./index-D1Rr9LMh.mjs";
2
2
  import "strapi-admin-portal";
3
3
  export {
4
4
  p as default
@@ -6,4 +6,4 @@ export interface ConfirmModalProps {
6
6
  secret?: string | null;
7
7
  passcodes?: string[] | null;
8
8
  }
9
- export default function ConfirmModal({ open, onOpenChange, onSubmit, qrCodeUri, secret, passcodes, }: ConfirmModalProps): import("react/jsx-runtime").JSX.Element;
9
+ export default function ConfirmModal({ open, onOpenChange, onSubmit, qrCodeUri, secret, passcodes, }: ConfirmModalProps): import("react").JSX.Element;
@@ -5,4 +5,4 @@ export interface EmailOTPModalProps {
5
5
  onOpenChange: (open: boolean) => void;
6
6
  onSuccess: () => void;
7
7
  }
8
- export default function EmailOTPModal({ mode, open, email, onOpenChange, onSuccess, }: EmailOTPModalProps): import("react/jsx-runtime").JSX.Element;
8
+ export default function EmailOTPModal({ mode, open, email, onOpenChange, onSuccess, }: EmailOTPModalProps): import("react").JSX.Element;
@@ -2,10 +2,10 @@ import { OTPInput } from 'input-otp';
2
2
  import * as React from 'react';
3
3
  declare function InputOTP({ className, containerClassName, ...props }: React.ComponentPropsWithoutRef<typeof OTPInput> & {
4
4
  containerClassName?: string;
5
- }): import("react/jsx-runtime").JSX.Element;
6
- declare function InputOTPGroup({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
5
+ }): React.JSX.Element;
6
+ declare function InputOTPGroup({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
7
7
  declare function InputOTPSlot({ index, className, ...props }: React.ComponentProps<'div'> & {
8
8
  index: number;
9
- }): import("react/jsx-runtime").JSX.Element;
10
- declare function InputOTPSeparator({ ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
9
+ }): React.JSX.Element;
10
+ declare function InputOTPSeparator({ ...props }: React.ComponentProps<'div'>): React.JSX.Element;
11
11
  export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
@@ -3,4 +3,4 @@ export interface RemoveModalProps {
3
3
  onOpenChange: (open: boolean) => void;
4
4
  onSubmit: React.FormEventHandler<HTMLFormElement>;
5
5
  }
6
- export default function RemoveModal({ open, onOpenChange, onSubmit }: RemoveModalProps): import("react/jsx-runtime").JSX.Element;
6
+ export default function RemoveModal({ open, onOpenChange, onSubmit }: RemoveModalProps): import("react").JSX.Element;
@@ -7,4 +7,4 @@ export interface WarningAlertProps {
7
7
  onConfirm: () => void;
8
8
  onCancel: () => void;
9
9
  }
10
- export default function WarningAlert({ open, title, children, confirmText, loading, onConfirm, onCancel, }: WarningAlertProps): import("react/jsx-runtime").JSX.Element;
10
+ export default function WarningAlert({ open, title, children, confirmText, loading, onConfirm, onCancel, }: WarningAlertProps): import("react").JSX.Element;
@@ -1,4 +1,4 @@
1
1
  declare const AdminReset: ({ id }: {
2
2
  id?: string;
3
- }) => import("react/jsx-runtime").JSX.Element;
3
+ }) => import("react").JSX.Element;
4
4
  export default AdminReset;
@@ -1,2 +1,2 @@
1
- declare const ProfileToggle: () => import("react/jsx-runtime").JSX.Element | null;
1
+ declare const ProfileToggle: () => import("react").JSX.Element | null;
2
2
  export default ProfileToggle;
@@ -9,5 +9,5 @@ export interface InjectPublicRouter extends Omit<StrapiApp['router'], 'router'>
9
9
  * Inject the enforced MFA page route into the Strapi admin router
10
10
  */
11
11
  export declare const InjectEnforced: (app: StrapiApp) => Promise<void>;
12
- declare const EnforcedPage: () => import("react/jsx-runtime").JSX.Element | null;
12
+ declare const EnforcedPage: () => import("react").JSX.Element | null;
13
13
  export { EnforcedPage };
@@ -1 +1 @@
1
- export default function SettingsPage(): import("react/jsx-runtime").JSX.Element;
1
+ export default function SettingsPage(): import("react").JSX.Element;
@@ -9966,13 +9966,10 @@ const controller = ({ strapi: strapi2 }) => ({
9966
9966
  );
9967
9967
  const accessResult = await sessionManager("admin").generateAccessToken(refreshToken);
9968
9968
  const { token: accessToken } = accessResult;
9969
- const domain = strapi2.config.get("admin.auth.domain");
9970
- const opt = { httpOnly: false, secure, overwrite: true, domain };
9971
- ctx.cookies.set("jwtToken", accessToken, opt);
9972
9969
  ctx.cookies.set("strapi_admin_mfa", null, { expires: /* @__PURE__ */ new Date(0) });
9973
9970
  ctx.status = 200;
9974
9971
  ctx.body = {
9975
- data: { token: accessToken, accessToken },
9972
+ data: { token: accessToken, accessToken, rememberMe: payload.rememberMe || false },
9976
9973
  error: null
9977
9974
  };
9978
9975
  } catch (error) {
@@ -10229,15 +10226,7 @@ const config$1 = [
10229
10226
  },
10230
10227
  config: {
10231
10228
  policies: [
10232
- "admin::isAuthenticatedAdmin",
10233
- {
10234
- name: "admin::hasPermissions",
10235
- config: {
10236
- actions: [
10237
- "plugin::strapi-identity.settings.read"
10238
- ]
10239
- }
10240
- }
10229
+ "admin::isAuthenticatedAdmin"
10241
10230
  ]
10242
10231
  }
10243
10232
  },
@@ -9959,13 +9959,10 @@ const controller = ({ strapi: strapi2 }) => ({
9959
9959
  );
9960
9960
  const accessResult = await sessionManager("admin").generateAccessToken(refreshToken);
9961
9961
  const { token: accessToken } = accessResult;
9962
- const domain = strapi2.config.get("admin.auth.domain");
9963
- const opt = { httpOnly: false, secure, overwrite: true, domain };
9964
- ctx.cookies.set("jwtToken", accessToken, opt);
9965
9962
  ctx.cookies.set("strapi_admin_mfa", null, { expires: /* @__PURE__ */ new Date(0) });
9966
9963
  ctx.status = 200;
9967
9964
  ctx.body = {
9968
- data: { token: accessToken, accessToken },
9965
+ data: { token: accessToken, accessToken, rememberMe: payload.rememberMe || false },
9969
9966
  error: null
9970
9967
  };
9971
9968
  } catch (error) {
@@ -10222,15 +10219,7 @@ const config$1 = [
10222
10219
  },
10223
10220
  config: {
10224
10221
  policies: [
10225
- "admin::isAuthenticatedAdmin",
10226
- {
10227
- name: "admin::hasPermissions",
10228
- config: {
10229
- actions: [
10230
- "plugin::strapi-identity.settings.read"
10231
- ]
10232
- }
10233
- }
10222
+ "admin::isAuthenticatedAdmin"
10234
10223
  ]
10235
10224
  }
10236
10225
  },
@@ -5,13 +5,7 @@ declare const _default: [
5
5
  "handler": "config.isEnabled",
6
6
  "info": { "apiName": "isEnabled", "pluginName": "strapi-identity", "type": "content-api" },
7
7
  "config": {
8
- "policies": [
9
- "admin::isAuthenticatedAdmin",
10
- {
11
- "name": "admin::hasPermissions",
12
- "config": { "actions": ["plugin::strapi-identity.settings.read"] }
13
- }
14
- ]
8
+ "policies": ["admin::isAuthenticatedAdmin"]
15
9
  }
16
10
  },
17
11
  {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.5.1",
2
+ "version": "0.6.1",
3
3
  "keywords": [
4
4
  "strapi",
5
5
  "plugin",
@@ -34,19 +34,20 @@
34
34
  "watch:link": "strapi-plugin watch:link",
35
35
  "verify": "strapi-plugin verify",
36
36
  "test:ts:front": "run -T tsc -p admin/tsconfig.json",
37
- "test:ts:back": "run -T tsc -p server/tsconfig.json"
37
+ "test:ts:back": "run -T tsc -p server/tsconfig.json",
38
+ "postversion": "git push && git push --tags"
38
39
  },
39
40
  "dependencies": {
40
41
  "input-otp": "^1.4.2",
41
- "otpauth": "^9.5.0",
42
+ "otpauth": "^9.5.1",
42
43
  "qrcode.react": "^4.2.0",
43
44
  "strapi-admin-portal": "^0.3.0"
44
45
  },
45
46
  "devDependencies": {
46
- "@strapi/sdk-plugin": "^6.1.0",
47
- "@strapi/typescript-utils": "^5.43.0",
47
+ "@strapi/sdk-plugin": "^6.1.1",
48
+ "@strapi/typescript-utils": "^5.47.1",
48
49
  "@types/bcryptjs": "^2.4.6",
49
- "@types/react": "^18.3.28",
50
+ "@types/react": "^18.3.30",
50
51
  "@types/react-dom": "^18.3.7",
51
52
  "prettier": "^3.8.3",
52
53
  "typescript": "^5.9.3"