strapi-plugin-oidc 1.0.15 → 1.0.17

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.
@@ -54,7 +54,7 @@ const index = {
54
54
  defaultMessage: "Configuration"
55
55
  },
56
56
  Component: async () => {
57
- return await import("./index-CINLwPy3.mjs");
57
+ return await import("./index-Uf8y9MCa.mjs");
58
58
  },
59
59
  permissions: [{ action: "plugin::strapi-plugin-oidc.read", subject: null }]
60
60
  }
@@ -55,7 +55,7 @@ const index = {
55
55
  defaultMessage: "Configuration"
56
56
  },
57
57
  Component: async () => {
58
- return await Promise.resolve().then(() => require("./index-C762D8BZ.js"));
58
+ return await Promise.resolve().then(() => require("./index-Dc3dS0bs.js"));
59
59
  },
60
60
  permissions: [{ action: "plugin::strapi-plugin-oidc.read", subject: null }]
61
61
  }
@@ -7,7 +7,7 @@ const react = require("react");
7
7
  const designSystem = require("@strapi/design-system");
8
8
  const icons = require("@strapi/icons");
9
9
  const reactIntl = require("react-intl");
10
- const index = require("./index-Cq1ERJUV.js");
10
+ const index = require("./index-CnfUHUlY.js");
11
11
  const en = require("./en-8UlbiAHW.js");
12
12
  const styled = require("styled-components");
13
13
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
@@ -70,19 +70,23 @@ function Whitelist({
70
70
  const [selectedRoles, setSelectedRoles] = react.useState([]);
71
71
  const [page, setPage] = react.useState(1);
72
72
  const { formatMessage } = reactIntl.useIntl();
73
+ const { toggleNotification } = admin.useNotification();
73
74
  const PAGE_SIZE = 10;
74
75
  const pageCount = Math.ceil(users.length / PAGE_SIZE) || 1;
75
76
  const paginatedUsers = users.slice((page - 1) * PAGE_SIZE, page * PAGE_SIZE);
76
77
  const onSaveEmail = react.useCallback(async () => {
77
78
  const emailText = email.trim();
78
79
  if (users.some((user) => user.email === emailText)) {
79
- alert(formatMessage(getTrad("whitelist.error.unique")));
80
+ toggleNotification({
81
+ type: "warning",
82
+ message: formatMessage(getTrad("whitelist.error.unique"))
83
+ });
80
84
  } else {
81
85
  await onSave(emailText, selectedRoles);
82
86
  setEmail("");
83
87
  setSelectedRoles([]);
84
88
  }
85
- }, [email, selectedRoles, users, onSave, formatMessage]);
89
+ }, [email, selectedRoles, users, onSave, formatMessage, toggleNotification]);
86
90
  const isValidEmail = react.useCallback(() => {
87
91
  const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
88
92
  return emailRegex.test(email);
@@ -1,11 +1,11 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { Routes, Route } from "react-router-dom";
3
- import { useFetchClient, Page, Layouts } from "@strapi/strapi/admin";
3
+ import { useNotification, useFetchClient, Page, Layouts } from "@strapi/strapi/admin";
4
4
  import { useState, useCallback, useEffect, memo } from "react";
5
5
  import { Typography, Flex, Box, MultiSelect, MultiSelectOption, Field, Button, Divider, Thead, Tr, Th, Tbody, Td, Dialog, IconButton, Pagination, PreviousLink, PageLink, NextLink, Table, Alert } from "@strapi/design-system";
6
6
  import { Plus, Trash, WarningCircle } from "@strapi/icons";
7
7
  import { useIntl } from "react-intl";
8
- import { p as pluginId } from "./index-BADTLgSt.mjs";
8
+ import { p as pluginId } from "./index-CaPOaw8Q.mjs";
9
9
  import en from "./en-DInn-mdh.mjs";
10
10
  import styled from "styled-components";
11
11
  function getTrad(id) {
@@ -66,19 +66,23 @@ function Whitelist({
66
66
  const [selectedRoles, setSelectedRoles] = useState([]);
67
67
  const [page, setPage] = useState(1);
68
68
  const { formatMessage } = useIntl();
69
+ const { toggleNotification } = useNotification();
69
70
  const PAGE_SIZE = 10;
70
71
  const pageCount = Math.ceil(users.length / PAGE_SIZE) || 1;
71
72
  const paginatedUsers = users.slice((page - 1) * PAGE_SIZE, page * PAGE_SIZE);
72
73
  const onSaveEmail = useCallback(async () => {
73
74
  const emailText = email.trim();
74
75
  if (users.some((user) => user.email === emailText)) {
75
- alert(formatMessage(getTrad("whitelist.error.unique")));
76
+ toggleNotification({
77
+ type: "warning",
78
+ message: formatMessage(getTrad("whitelist.error.unique"))
79
+ });
76
80
  } else {
77
81
  await onSave(emailText, selectedRoles);
78
82
  setEmail("");
79
83
  setSelectedRoles([]);
80
84
  }
81
- }, [email, selectedRoles, users, onSave, formatMessage]);
85
+ }, [email, selectedRoles, users, onSave, formatMessage, toggleNotification]);
82
86
  const isValidEmail = useCallback(() => {
83
87
  const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
84
88
  return emailRegex.test(email);
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const index = require("./index-Cq1ERJUV.js");
3
+ const index = require("./index-CnfUHUlY.js");
4
4
  exports.default = index.index;
@@ -1,4 +1,4 @@
1
- import { i } from "./index-BADTLgSt.mjs";
1
+ import { i } from "./index-CaPOaw8Q.mjs";
2
2
  export {
3
3
  i as default
4
4
  };
@@ -171,7 +171,7 @@ async function oidcSignIn(ctx) {
171
171
  if (!state) {
172
172
  state = node_crypto.randomBytes(32).toString("base64url");
173
173
  }
174
- const isProduction = process.env.NODE_ENV === "production";
174
+ const isProduction = strapi.config.get("environment") === "production";
175
175
  ctx.cookies.set("oidc_code_verifier", codeVerifier, {
176
176
  httpOnly: true,
177
177
  maxAge: 6e5,
@@ -165,7 +165,7 @@ async function oidcSignIn(ctx) {
165
165
  if (!state) {
166
166
  state = randomBytes(32).toString("base64url");
167
167
  }
168
- const isProduction = process.env.NODE_ENV === "production";
168
+ const isProduction = strapi.config.get("environment") === "production";
169
169
  ctx.cookies.set("oidc_code_verifier", codeVerifier, {
170
170
  httpOnly: true,
171
171
  maxAge: 6e5,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strapi-plugin-oidc",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "description": "A Strapi plugin that provides OpenID Connect (OIDC) authentication functionality for the Strapi Admin Panel.",
5
5
  "strapi": {
6
6
  "displayName": "OIDC Plugin",