strapi-plugin-magic-sessionmanager 4.19.0 → 4.20.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.
- package/CHANGELOG.md +38 -0
- package/README.md +136 -1
- package/dist/admin/{Analytics-DSXe9BPn.mjs → Analytics-B-MVQ6dQ.mjs} +1 -1
- package/dist/admin/{Analytics-AzG-hPvn.js → Analytics-B5GnwMtH.js} +1 -1
- package/dist/admin/{App-7UDfLwMK.mjs → App-DzbP5VPQ.mjs} +107 -58
- package/dist/admin/{App-D08oGxy4.js → App-xBOmg4g9.js} +140 -91
- package/dist/admin/{OnlineUsersWidget-DIhJZ77w.mjs → OnlineUsersWidget-Bf3BICmx.mjs} +1 -1
- package/dist/admin/{OnlineUsersWidget-CK0_o7Jk.js → OnlineUsersWidget-FuPPPCCV.js} +1 -1
- package/dist/admin/{Settings-DnNBDP1I.js → Settings-WRIXHLDa.js} +315 -330
- package/dist/admin/{Settings-CneNJppG.mjs → Settings-hpkloyO6.mjs} +250 -265
- package/dist/admin/{de-DvYUwhjB.mjs → de-Bzd14FzX.mjs} +64 -1
- package/dist/admin/{de-CJZtJdhC.js → de-Uqb30N5n.js} +64 -1
- package/dist/admin/{en-BZ2YkNIU.js → en-CDBcocLk.js} +64 -1
- package/dist/admin/{en-B8m9k-qd.mjs → en-DovyVwa5.mjs} +64 -1
- package/dist/admin/{es-DBH36rrX.mjs → es-BygJxl1J.mjs} +64 -1
- package/dist/admin/{es-BBsMtof1.js → es-DA1X0RPv.js} +64 -1
- package/dist/admin/{fr-Cw6nc38j.js → fr-CPPA27jW.js} +64 -1
- package/dist/admin/{fr-CLvB1rGe.mjs → fr-DONxL73-.mjs} +64 -1
- package/dist/admin/{index-5Zb3GVml.mjs → index-DsaGGK7x.mjs} +627 -61
- package/dist/admin/{index-BSUrdxxt.js → index-Q_D-5LlE.js} +612 -46
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +2 -2
- package/dist/admin/{pt-CjnMe7Z-.js → pt-BMuwyaan.js} +64 -1
- package/dist/admin/{pt-CVht14if.mjs → pt-D2yGNz2N.mjs} +64 -1
- package/dist/admin/settingsTabs--7IsqMdn.mjs +437 -0
- package/dist/admin/settingsTabs-Dxlevody.js +436 -0
- package/dist/server/index.js +1485 -19
- package/dist/server/index.mjs +1485 -19
- package/package.json +1 -1
- package/dist/admin/dashboardModel-CjU0V7Sx.js +0 -188
- package/dist/admin/dashboardModel-OyQ_39aF.mjs +0 -189
|
@@ -6,243 +6,13 @@ const designSystem = require("@strapi/design-system");
|
|
|
6
6
|
const StrapiAdmin = require("@strapi/strapi/admin");
|
|
7
7
|
const icons = require("@strapi/icons");
|
|
8
8
|
const styled = require("styled-components");
|
|
9
|
-
const index = require("./index-
|
|
10
|
-
|
|
9
|
+
const index = require("./index-Q_D-5LlE.js");
|
|
10
|
+
require("react-intl");
|
|
11
|
+
const settingsTabs = require("./settingsTabs-Dxlevody.js");
|
|
11
12
|
const SectionCard = require("./SectionCard-BlWv8CRt.js");
|
|
12
|
-
const dashboardModel = require("./dashboardModel-CjU0V7Sx.js");
|
|
13
13
|
const symbols = require("@strapi/icons/symbols");
|
|
14
14
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
15
15
|
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
16
|
-
const SETTINGS_TAB_IDS = Object.freeze([
|
|
17
|
-
"sessions",
|
|
18
|
-
"login-protection",
|
|
19
|
-
"location-data",
|
|
20
|
-
"alerts",
|
|
21
|
-
"data-retention",
|
|
22
|
-
"admin-activity"
|
|
23
|
-
]);
|
|
24
|
-
const PERMISSION_GATED_TABS = Object.freeze(["admin-activity"]);
|
|
25
|
-
const DEFAULT_SETTINGS_TAB = "sessions";
|
|
26
|
-
const SETTINGS_TAB_LABELS = Object.freeze({
|
|
27
|
-
sessions: ["settings.config.tab.sessions", "Sessions"],
|
|
28
|
-
"login-protection": ["settings.config.tab.loginProtection", "Login protection"],
|
|
29
|
-
"location-data": ["settings.config.tab.locationData", "Location data"],
|
|
30
|
-
alerts: ["settings.config.tab.alerts", "Alerts"],
|
|
31
|
-
"data-retention": ["settings.config.tab.dataRetention", "Data and retention"],
|
|
32
|
-
"admin-activity": ["settings.config.tab.adminActivity", "Admin activity"]
|
|
33
|
-
});
|
|
34
|
-
const SETTINGS_TAB_FIELDS = Object.freeze({
|
|
35
|
-
sessions: [
|
|
36
|
-
"inactivityTimeout",
|
|
37
|
-
"maxSessionAgeDays",
|
|
38
|
-
"lastSeenRateLimit",
|
|
39
|
-
"cleanupInterval",
|
|
40
|
-
"cleanupUseDbDirect",
|
|
41
|
-
"strictSessionEnforcement",
|
|
42
|
-
"sessionCreationGraceMs",
|
|
43
|
-
"maxSessionsPerUser",
|
|
44
|
-
"sessionLimitPolicy",
|
|
45
|
-
"endOtherSessionsOnPasswordChange",
|
|
46
|
-
"roleRules"
|
|
47
|
-
],
|
|
48
|
-
"login-protection": [
|
|
49
|
-
"maxFailedLogins",
|
|
50
|
-
"maxFailedLoginsPerAccount",
|
|
51
|
-
"lockoutWindowMinutes",
|
|
52
|
-
"lockoutDurationMinutes",
|
|
53
|
-
"lockoutTrustedAddresses",
|
|
54
|
-
"lockoutNotifyUser",
|
|
55
|
-
"recordUserSignInEvents",
|
|
56
|
-
"impossibleTravelEnabled",
|
|
57
|
-
"impossibleTravelSpeedKmh",
|
|
58
|
-
"impossibleTravelMinDistanceKm",
|
|
59
|
-
"impossibleTravelAction",
|
|
60
|
-
"trustedProxies",
|
|
61
|
-
"blockSuspiciousSessions",
|
|
62
|
-
"geoLookupFailureMode",
|
|
63
|
-
"enableGeofencing",
|
|
64
|
-
"allowedCountries",
|
|
65
|
-
"blockedCountries"
|
|
66
|
-
],
|
|
67
|
-
"location-data": [
|
|
68
|
-
"enableGeolocation",
|
|
69
|
-
"enableSecurityScoring",
|
|
70
|
-
"geoIpProvider",
|
|
71
|
-
"geoIpDatabasePath"
|
|
72
|
-
],
|
|
73
|
-
alerts: [
|
|
74
|
-
"enableEmailAlerts",
|
|
75
|
-
"alertOnSuspiciousLogin",
|
|
76
|
-
"alertOnNewLocation",
|
|
77
|
-
"alertOnVpnProxy",
|
|
78
|
-
"emailTemplates",
|
|
79
|
-
"enableWebhooks",
|
|
80
|
-
"discordWebhookUrl",
|
|
81
|
-
"slackWebhookUrl",
|
|
82
|
-
"alertOnNewDevice",
|
|
83
|
-
"alertOnImpossibleTravel",
|
|
84
|
-
"webhookEvents",
|
|
85
|
-
"genericWebhookEnabled",
|
|
86
|
-
"genericWebhookUrl",
|
|
87
|
-
"genericWebhookSecret"
|
|
88
|
-
],
|
|
89
|
-
"data-retention": ["retentionDays", "sessionIpAnonymize"],
|
|
90
|
-
"admin-activity": [
|
|
91
|
-
"adminSignInHistory",
|
|
92
|
-
"adminContentActivity",
|
|
93
|
-
"securityLogStoreIp",
|
|
94
|
-
"securityLogAnonymizeIp",
|
|
95
|
-
"securityLogGeoLookup",
|
|
96
|
-
"securityLogRetentionDays"
|
|
97
|
-
]
|
|
98
|
-
});
|
|
99
|
-
const PRESERVED_SETTINGS_KEYS = Object.freeze([
|
|
100
|
-
"rateLimitWriteMax",
|
|
101
|
-
"rateLimitReadMax",
|
|
102
|
-
"rateLimitWindowSeconds"
|
|
103
|
-
]);
|
|
104
|
-
const SETTINGS_FIELD_LABELS = Object.freeze({
|
|
105
|
-
inactivityTimeout: ["settings.config.sessions.inactivity.label", "Inactivity timeout"],
|
|
106
|
-
maxSessionAgeDays: ["settings.config.sessions.maxAge.label", "Maximum session age"],
|
|
107
|
-
lastSeenRateLimit: [
|
|
108
|
-
"settings.config.sessions.lastSeen.label",
|
|
109
|
-
'Update "Last active" at most every'
|
|
110
|
-
],
|
|
111
|
-
cleanupInterval: ["settings.config.sessions.idleCheck.label", "Run idle check every"],
|
|
112
|
-
cleanupUseDbDirect: ["settings.config.sessions.idleMethod.label", "Idle check method"],
|
|
113
|
-
strictSessionEnforcement: ["settings.config.token.check.label", "Strict token check"],
|
|
114
|
-
sessionCreationGraceMs: ["settings.config.token.grace.label", "Grace period after sign-in"],
|
|
115
|
-
maxFailedLogins: ["settings.config.failed.lockout.label", "Lock an IP address after"],
|
|
116
|
-
maxFailedLoginsPerAccount: ["settings.config.failed.account.label", "Lock an account after"],
|
|
117
|
-
lockoutWindowMinutes: ["settings.config.failed.window.label", "Count failed sign-ins within"],
|
|
118
|
-
lockoutDurationMinutes: ["settings.config.failed.duration.label", "Lock for"],
|
|
119
|
-
lockoutTrustedAddresses: ["settings.config.failed.trusted.label", "Trusted addresses"],
|
|
120
|
-
lockoutNotifyUser: [
|
|
121
|
-
"settings.config.failed.notify.label",
|
|
122
|
-
"Email the user when their account is locked"
|
|
123
|
-
],
|
|
124
|
-
recordUserSignInEvents: [
|
|
125
|
-
"settings.config.failed.record.label",
|
|
126
|
-
"Record failed and refused sign-ins"
|
|
127
|
-
],
|
|
128
|
-
maxSessionsPerUser: ["settings.config.sessionLimit.max.label", "Open sessions per user"],
|
|
129
|
-
sessionLimitPolicy: ["settings.config.sessionLimit.policy.label", "When the limit is reached"],
|
|
130
|
-
endOtherSessionsOnPasswordChange: [
|
|
131
|
-
"settings.config.passwordChange.label",
|
|
132
|
-
"End other sessions after a password change"
|
|
133
|
-
],
|
|
134
|
-
roleRules: ["settings.roleRules.title", "Different rules for some roles"],
|
|
135
|
-
impossibleTravelEnabled: ["settings.config.travel.enable.label", "Detect impossible travel"],
|
|
136
|
-
impossibleTravelSpeedKmh: ["settings.config.travel.speed.label", "Faster than"],
|
|
137
|
-
impossibleTravelMinDistanceKm: ["settings.config.travel.distance.label", "Over at least"],
|
|
138
|
-
impossibleTravelAction: ["settings.config.travel.action.label", "Then"],
|
|
139
|
-
alertOnNewDevice: ["settings.config.email.newDevice.label", "Sign-in from a new device"],
|
|
140
|
-
alertOnImpossibleTravel: ["settings.config.email.travel.label", "Impossible travel"],
|
|
141
|
-
webhookEvents: ["settings.webhookEvents.title", "Events to send"],
|
|
142
|
-
genericWebhookEnabled: ["settings.signedWebhook.enable.label", "Send to the signed webhook"],
|
|
143
|
-
genericWebhookUrl: ["settings.signedWebhook.url.label", "Webhook URL"],
|
|
144
|
-
genericWebhookSecret: ["settings.signedWebhook.secret.label", "Signing secret"],
|
|
145
|
-
sessionIpAnonymize: ["settings.config.privacy.shortIp.label", "Shorten IP addresses of sessions"],
|
|
146
|
-
trustedProxies: ["settings.config.clientIp.trustProxy.label", "Trust proxy headers"],
|
|
147
|
-
blockSuspiciousSessions: [
|
|
148
|
-
"settings.config.suspicious.reject.label",
|
|
149
|
-
"Reject suspicious sign-ins"
|
|
150
|
-
],
|
|
151
|
-
geoLookupFailureMode: [
|
|
152
|
-
"settings.config.suspicious.failureMode.label",
|
|
153
|
-
"If the location cannot be determined"
|
|
154
|
-
],
|
|
155
|
-
enableGeofencing: ["settings.config.countries.enable.label", "Use country rules"],
|
|
156
|
-
allowedCountries: ["settings.config.countries.list.label", "Countries"],
|
|
157
|
-
blockedCountries: ["settings.config.countries.list.label", "Countries"],
|
|
158
|
-
enableGeolocation: ["settings.config.lookup.enable.label", "IP location lookup"],
|
|
159
|
-
enableSecurityScoring: ["settings.config.lookup.scoring.label", "Security scoring"],
|
|
160
|
-
geoIpProvider: ["settings.config.provider.label", "Provider"],
|
|
161
|
-
geoIpDatabasePath: ["settings.config.database.fileName.label", "Database file name"],
|
|
162
|
-
enableEmailAlerts: ["settings.config.email.enable.label", "Send security emails"],
|
|
163
|
-
alertOnSuspiciousLogin: ["settings.config.email.suspicious.label", "Suspicious sign-in"],
|
|
164
|
-
alertOnNewLocation: ["settings.config.email.newCountry.label", "Sign-in from a new country"],
|
|
165
|
-
alertOnVpnProxy: ["settings.config.email.vpnProxy.label", "VPN or proxy"],
|
|
166
|
-
emailTemplates: ["settings.config.email.templates.field", "Email templates"],
|
|
167
|
-
enableWebhooks: ["settings.config.webhooks.enable.label", "Send team notifications"],
|
|
168
|
-
discordWebhookUrl: ["settings.config.webhooks.discord.label", "Discord webhook URL"],
|
|
169
|
-
slackWebhookUrl: ["settings.config.webhooks.slack.label", "Slack webhook URL"],
|
|
170
|
-
retentionDays: ["settings.config.retention.keep.label", "Keep ended sessions for"],
|
|
171
|
-
adminSignInHistory: ["settings.config.adminActivity.signIns.label", "Record admin sign-ins"],
|
|
172
|
-
adminContentActivity: [
|
|
173
|
-
"settings.config.adminActivity.content.label",
|
|
174
|
-
"Record Content Manager activity"
|
|
175
|
-
],
|
|
176
|
-
securityLogStoreIp: ["settings.config.adminActivity.storeIp.label", "Store IP addresses"],
|
|
177
|
-
securityLogAnonymizeIp: [
|
|
178
|
-
"settings.config.adminActivity.anonymize.label",
|
|
179
|
-
"Anonymise the last part of IP addresses"
|
|
180
|
-
],
|
|
181
|
-
securityLogGeoLookup: [
|
|
182
|
-
"settings.config.adminActivity.geoLookup.label",
|
|
183
|
-
"Look up the location of security events"
|
|
184
|
-
],
|
|
185
|
-
securityLogRetentionDays: [
|
|
186
|
-
"settings.config.adminActivity.retention.label",
|
|
187
|
-
"Keep security events for"
|
|
188
|
-
]
|
|
189
|
-
});
|
|
190
|
-
const SELECT_PRESETS = Object.freeze({
|
|
191
|
-
inactivityTimeout: Object.freeze([5, 10, 15, 30, 60, 120]),
|
|
192
|
-
maxSessionAgeDays: Object.freeze([1, 7, 14, 30, 60, 90, 180, 365]),
|
|
193
|
-
lastSeenRateLimit: Object.freeze([10, 30, 60, 120, 300]),
|
|
194
|
-
cleanupInterval: Object.freeze([15, 30, 60, 120]),
|
|
195
|
-
sessionCreationGraceMs: Object.freeze([0, 2e3, 5e3, 1e4, 3e4]),
|
|
196
|
-
retentionDays: Object.freeze([7, 30, 60, 90, 180, 365, -1]),
|
|
197
|
-
securityLogRetentionDays: Object.freeze([7, 30, 90, 180, 365])
|
|
198
|
-
});
|
|
199
|
-
function resolveSettingsTab(value, tabs = SETTINGS_TAB_IDS) {
|
|
200
|
-
const candidate = Array.isArray(value) ? value[0] : value;
|
|
201
|
-
return tabs.includes(candidate) ? candidate : DEFAULT_SETTINGS_TAB;
|
|
202
|
-
}
|
|
203
|
-
function getVisibleSettingsTabs(canViewAdminActivity) {
|
|
204
|
-
return SETTINGS_TAB_IDS.filter(
|
|
205
|
-
(tab) => canViewAdminActivity || !PERMISSION_GATED_TABS.includes(tab)
|
|
206
|
-
);
|
|
207
|
-
}
|
|
208
|
-
function buildTabSearch(search, tab) {
|
|
209
|
-
const params = new URLSearchParams(typeof search === "string" ? search : "");
|
|
210
|
-
params.set("tab", resolveSettingsTab(tab));
|
|
211
|
-
return `?${params.toString()}`;
|
|
212
|
-
}
|
|
213
|
-
function fieldHasError(errors, field) {
|
|
214
|
-
return Object.keys(errors || {}).some((path) => path === field || path.startsWith(`${field}.`));
|
|
215
|
-
}
|
|
216
|
-
function tabHasFieldErrors(errors, tab) {
|
|
217
|
-
return (SETTINGS_TAB_FIELDS[tab] || []).some((field) => fieldHasError(errors, field));
|
|
218
|
-
}
|
|
219
|
-
function getErrorTab(errors) {
|
|
220
|
-
return SETTINGS_TAB_IDS.find((tab) => tabHasFieldErrors(errors, tab));
|
|
221
|
-
}
|
|
222
|
-
function buildSelectOptions(presets, current) {
|
|
223
|
-
const options = presets.map((value) => ({ value, custom: false }));
|
|
224
|
-
const number = typeof current === "number" ? current : Number.parseInt(String(current ?? ""), 10);
|
|
225
|
-
if (Number.isInteger(number) && !presets.includes(number)) {
|
|
226
|
-
options.push({ value: number, custom: true });
|
|
227
|
-
}
|
|
228
|
-
return options;
|
|
229
|
-
}
|
|
230
|
-
function buildSavePayload(draft, saved) {
|
|
231
|
-
const payload = { ...draft || {} };
|
|
232
|
-
for (const key of PRESERVED_SETTINGS_KEYS) {
|
|
233
|
-
if (saved && Object.prototype.hasOwnProperty.call(saved, key)) payload[key] = saved[key];
|
|
234
|
-
}
|
|
235
|
-
return payload;
|
|
236
|
-
}
|
|
237
|
-
function usesLocalDatabase(provider) {
|
|
238
|
-
return provider === void 0 || provider === null || provider === "" || provider === "auto" || provider === "local-mmdb";
|
|
239
|
-
}
|
|
240
|
-
function getRevealScrollDelta(listRect, tabRect) {
|
|
241
|
-
if (!listRect || !tabRect) return 0;
|
|
242
|
-
if (tabRect.left < listRect.left - 0.5) return Math.round(tabRect.left - listRect.left);
|
|
243
|
-
if (tabRect.right > listRect.right + 0.5) return Math.round(tabRect.right - listRect.right);
|
|
244
|
-
return 0;
|
|
245
|
-
}
|
|
246
16
|
const FieldFrame = styled__default.default.div`
|
|
247
17
|
width: 100%;
|
|
248
18
|
min-width: 0;
|
|
@@ -520,18 +290,6 @@ const SecretTextInput = ({
|
|
|
520
290
|
}
|
|
521
291
|
);
|
|
522
292
|
};
|
|
523
|
-
function useSettingsTranslate() {
|
|
524
|
-
const { formatMessage, locale } = reactIntl.useIntl();
|
|
525
|
-
const t = react.useCallback(
|
|
526
|
-
(id, defaultMessage, values) => formatMessage({ id: index.getTranslation(id), defaultMessage }, values),
|
|
527
|
-
[formatMessage]
|
|
528
|
-
);
|
|
529
|
-
const tError = react.useCallback(
|
|
530
|
-
(descriptor) => descriptor ? t(descriptor.messageId, descriptor.defaultMessage, descriptor.values) : void 0,
|
|
531
|
-
[t]
|
|
532
|
-
);
|
|
533
|
-
return { t, tError, locale };
|
|
534
|
-
}
|
|
535
293
|
const EnvPreview = styled__default.default(designSystem.Box)`
|
|
536
294
|
overflow-wrap: anywhere;
|
|
537
295
|
|
|
@@ -546,7 +304,7 @@ const useEncryptionKeyDraft = () => {
|
|
|
546
304
|
return { encryptionKey, setEncryptionKey, showEncryptionKey, setShowEncryptionKey };
|
|
547
305
|
};
|
|
548
306
|
const EncryptionKeyCard = ({ draft, copyValue, notify }) => {
|
|
549
|
-
const { t } = useSettingsTranslate();
|
|
307
|
+
const { t } = index.useSettingsTranslate();
|
|
550
308
|
const { encryptionKey, setEncryptionKey, showEncryptionKey, setShowEncryptionKey } = draft;
|
|
551
309
|
const handleGenerate = () => {
|
|
552
310
|
try {
|
|
@@ -647,7 +405,7 @@ const SettingsTabLink = ({ tab, children }) => {
|
|
|
647
405
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
648
406
|
TabLink,
|
|
649
407
|
{
|
|
650
|
-
href: buildTabSearch(search, tab),
|
|
408
|
+
href: settingsTabs.buildTabSearch(search, tab),
|
|
651
409
|
onClick: (event) => {
|
|
652
410
|
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button !== 0)
|
|
653
411
|
return;
|
|
@@ -659,7 +417,7 @@ const SettingsTabLink = ({ tab, children }) => {
|
|
|
659
417
|
);
|
|
660
418
|
};
|
|
661
419
|
function useOptionLabels() {
|
|
662
|
-
const { t } = useSettingsTranslate();
|
|
420
|
+
const { t } = index.useSettingsTranslate();
|
|
663
421
|
return react.useMemo(() => {
|
|
664
422
|
const minutes = (count) => t("settings.config.unit.minutes", "{count} min", { count });
|
|
665
423
|
const seconds = (count) => t("settings.config.unit.seconds", "{count} s", { count });
|
|
@@ -677,18 +435,18 @@ function useOptionLabels() {
|
|
|
677
435
|
const IntroText = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(index.ReadableText, { variant: "omega", textColor: "neutral600", tag: "p", children });
|
|
678
436
|
const RequiresNotice = ({ tab, children }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", tag: "p", "data-requires": "", children: tab ? /* @__PURE__ */ jsxRuntime.jsx(SettingsTabLink, { tab, children }) : children });
|
|
679
437
|
const ProtectedNotice = () => {
|
|
680
|
-
const { t } = useSettingsTranslate();
|
|
438
|
+
const { t } = index.useSettingsTranslate();
|
|
681
439
|
return /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { children: t(
|
|
682
440
|
"settings.config.protected.notice",
|
|
683
441
|
"Read-only for your role: changing this needs the “Change protected settings” permission."
|
|
684
442
|
) });
|
|
685
443
|
};
|
|
686
444
|
const RequiresGeolocation = () => {
|
|
687
|
-
const { t } = useSettingsTranslate();
|
|
445
|
+
const { t } = index.useSettingsTranslate();
|
|
688
446
|
return /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { tab: "location-data", children: t("settings.config.requires.geolocation", "Requires IP location lookup") });
|
|
689
447
|
};
|
|
690
448
|
const RiskSourceNotice = ({ savedOn = false, tab = "location-data" }) => {
|
|
691
|
-
const { t } = useSettingsTranslate();
|
|
449
|
+
const { t } = index.useSettingsTranslate();
|
|
692
450
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 1, "data-risk-source-notice": "", children: [
|
|
693
451
|
/* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { tab: tab || void 0, children: t("settings.config.requires.riskData", "Needs a risk data source") }),
|
|
694
452
|
savedOn ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", tag: "p", children: t(
|
|
@@ -704,7 +462,7 @@ const AdvancedTrigger = styled__default.default(designSystem.Accordion.Trigger)`
|
|
|
704
462
|
}
|
|
705
463
|
`;
|
|
706
464
|
const AdvancedSection = ({ label, hasError = false, disabled = false, children }) => {
|
|
707
|
-
const { t } = useSettingsTranslate();
|
|
465
|
+
const { t } = index.useSettingsTranslate();
|
|
708
466
|
const itemValue = react.useId();
|
|
709
467
|
const [open, setOpen] = react.useState("");
|
|
710
468
|
const [hadError, setHadError] = react.useState(false);
|
|
@@ -730,7 +488,7 @@ const PresetSelect = ({
|
|
|
730
488
|
disabled = false
|
|
731
489
|
}) => {
|
|
732
490
|
const { custom } = useOptionLabels();
|
|
733
|
-
const options = buildSelectOptions(presets, value);
|
|
491
|
+
const options = settingsTabs.buildSelectOptions(presets, value);
|
|
734
492
|
return /* @__PURE__ */ jsxRuntime.jsx(FormField, { id, name, label, description, error, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
735
493
|
designSystem.SingleSelect,
|
|
736
494
|
{
|
|
@@ -924,9 +682,9 @@ function sortLocks(locks) {
|
|
|
924
682
|
return Number.isFinite(until) && until !== 0 ? until : String(a.id).localeCompare(b.id);
|
|
925
683
|
});
|
|
926
684
|
}
|
|
927
|
-
const TABLE_MIN_WIDTH$
|
|
928
|
-
const keepActionKeys$
|
|
929
|
-
if (
|
|
685
|
+
const TABLE_MIN_WIDTH$2 = 640;
|
|
686
|
+
const keepActionKeys$2 = (event) => {
|
|
687
|
+
if (settingsTabs.shouldIsolateActionKey(event.key, true)) event.stopPropagation();
|
|
930
688
|
};
|
|
931
689
|
const EMPTY_DRAFT = Object.freeze({
|
|
932
690
|
role: "",
|
|
@@ -935,14 +693,14 @@ const EMPTY_DRAFT = Object.freeze({
|
|
|
935
693
|
maxFailedLoginsPerAccount: void 0
|
|
936
694
|
});
|
|
937
695
|
const RuleValue = ({ value, format }) => {
|
|
938
|
-
const { t } = useSettingsTranslate();
|
|
696
|
+
const { t } = index.useSettingsTranslate();
|
|
939
697
|
if (value === null || value === void 0) {
|
|
940
698
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", children: t("settings.roleRules.general", "General setting") });
|
|
941
699
|
}
|
|
942
700
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", children: format(value) });
|
|
943
701
|
};
|
|
944
702
|
const RoleRulesSection = ({ form }) => {
|
|
945
|
-
const { t, tError } = useSettingsTranslate();
|
|
703
|
+
const { t, tError } = index.useSettingsTranslate();
|
|
946
704
|
const { get } = StrapiAdmin.useFetchClient();
|
|
947
705
|
const { settings, handleChange } = form;
|
|
948
706
|
const locked = form.canChangeProtected === false;
|
|
@@ -954,7 +712,7 @@ const RoleRulesSection = ({ form }) => {
|
|
|
954
712
|
const [showErrors, setShowErrors] = react.useState(false);
|
|
955
713
|
const addRef = react.useRef(null);
|
|
956
714
|
const returnFocusRef = react.useRef(null);
|
|
957
|
-
const [widthRef, width] =
|
|
715
|
+
const [widthRef, width] = settingsTabs.useElementWidth();
|
|
958
716
|
react.useEffect(() => {
|
|
959
717
|
let active = true;
|
|
960
718
|
get(`/${index.pluginId}/roles`).then(({ data }) => {
|
|
@@ -1012,10 +770,10 @@ const RoleRulesSection = ({ form }) => {
|
|
|
1012
770
|
};
|
|
1013
771
|
const fieldError = (key) => showErrors ? tError(draftErrors[key]) : void 0;
|
|
1014
772
|
const availableRoles = (roles || []).filter((role) => !taken.includes(role.documentId));
|
|
1015
|
-
const asTable = width === 0 || width >= TABLE_MIN_WIDTH$
|
|
773
|
+
const asTable = width === 0 || width >= TABLE_MIN_WIDTH$2;
|
|
1016
774
|
const actions = (rule) => {
|
|
1017
775
|
const name = roleName(rule.role);
|
|
1018
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
776
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(settingsTabs.RowActions, { onKeyDown: keepActionKeys$2, children: [
|
|
1019
777
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1020
778
|
designSystem.IconButton,
|
|
1021
779
|
{
|
|
@@ -1253,7 +1011,7 @@ const formatReasonCodes = (locale) => {
|
|
|
1253
1011
|
}
|
|
1254
1012
|
};
|
|
1255
1013
|
const SessionsTab = ({ form }) => {
|
|
1256
|
-
const { t, tError, locale } = useSettingsTranslate();
|
|
1014
|
+
const { t, tError, locale } = index.useSettingsTranslate();
|
|
1257
1015
|
const units = useOptionLabels();
|
|
1258
1016
|
const encryptionKeyDraft = useEncryptionKeyDraft();
|
|
1259
1017
|
const { settings, handleChange, relaxedWarningDismissed, setRelaxedWarningDismissed, errors } = form;
|
|
@@ -1286,7 +1044,7 @@ const SessionsTab = ({ form }) => {
|
|
|
1286
1044
|
"A session unused for this long becomes idle and ends as 'Timed out' on its next request or at the next idle check. Also decides who counts as online."
|
|
1287
1045
|
),
|
|
1288
1046
|
value: settings.inactivityTimeout,
|
|
1289
|
-
presets: SELECT_PRESETS.inactivityTimeout,
|
|
1047
|
+
presets: settingsTabs.SELECT_PRESETS.inactivityTimeout,
|
|
1290
1048
|
format: units.minutes,
|
|
1291
1049
|
onChange: (value) => handleChange("inactivityTimeout", value)
|
|
1292
1050
|
}
|
|
@@ -1302,7 +1060,7 @@ const SessionsTab = ({ form }) => {
|
|
|
1302
1060
|
"Counted from sign-in, regardless of activity. Applied on the session's next request; until then the session can still show as active or idle."
|
|
1303
1061
|
),
|
|
1304
1062
|
value: settings.maxSessionAgeDays,
|
|
1305
|
-
presets: SELECT_PRESETS.maxSessionAgeDays,
|
|
1063
|
+
presets: settingsTabs.SELECT_PRESETS.maxSessionAgeDays,
|
|
1306
1064
|
format: units.days,
|
|
1307
1065
|
onChange: (value) => handleChange("maxSessionAgeDays", value)
|
|
1308
1066
|
}
|
|
@@ -1324,7 +1082,7 @@ const SessionsTab = ({ form }) => {
|
|
|
1324
1082
|
"Lower values make 'Last active' and idle detection more precise but write to the database more often."
|
|
1325
1083
|
),
|
|
1326
1084
|
value: settings.lastSeenRateLimit,
|
|
1327
|
-
presets: SELECT_PRESETS.lastSeenRateLimit,
|
|
1085
|
+
presets: settingsTabs.SELECT_PRESETS.lastSeenRateLimit,
|
|
1328
1086
|
format: units.seconds,
|
|
1329
1087
|
onChange: (value) => handleChange("lastSeenRateLimit", value)
|
|
1330
1088
|
}
|
|
@@ -1345,7 +1103,7 @@ const SessionsTab = ({ form }) => {
|
|
|
1345
1103
|
"The idle check ends idle sessions as 'Timed out'. It deletes nothing. It also runs once at server start."
|
|
1346
1104
|
),
|
|
1347
1105
|
value: settings.cleanupInterval,
|
|
1348
|
-
presets: SELECT_PRESETS.cleanupInterval,
|
|
1106
|
+
presets: settingsTabs.SELECT_PRESETS.cleanupInterval,
|
|
1349
1107
|
format: units.minutes,
|
|
1350
1108
|
onChange: (value) => handleChange("cleanupInterval", value)
|
|
1351
1109
|
}
|
|
@@ -1432,7 +1190,7 @@ const SessionsTab = ({ form }) => {
|
|
|
1432
1190
|
"Accepts a new token for a few seconds while its session record is being created. Only for tokens without a session record. Not used when Strapi's refresh-token mode (jwtManagement: 'refresh') is on."
|
|
1433
1191
|
),
|
|
1434
1192
|
value: settings.sessionCreationGraceMs ?? 5e3,
|
|
1435
|
-
presets: SELECT_PRESETS.sessionCreationGraceMs,
|
|
1193
|
+
presets: settingsTabs.SELECT_PRESETS.sessionCreationGraceMs,
|
|
1436
1194
|
format: units.graceMs,
|
|
1437
1195
|
onChange: (value) => handleChange("sessionCreationGraceMs", value)
|
|
1438
1196
|
}
|
|
@@ -2344,7 +2102,9 @@ const SETTINGS_DEFAULTS = Object.freeze({
|
|
|
2344
2102
|
securityLogGeoLookup: false,
|
|
2345
2103
|
securityLogRetentionDays: 90,
|
|
2346
2104
|
...POLICY_FORM_DEFAULTS,
|
|
2347
|
-
...SIGNALS_FORM_DEFAULTS
|
|
2105
|
+
...SIGNALS_FORM_DEFAULTS,
|
|
2106
|
+
// Impersonation of app users (4.20), off by default.
|
|
2107
|
+
impersonationEnabled: false
|
|
2348
2108
|
});
|
|
2349
2109
|
const WRITE_ONLY_SETTINGS_KEYS = Object.freeze([
|
|
2350
2110
|
"discordWebhookUrl",
|
|
@@ -2469,12 +2229,12 @@ function getAdjustedFields(submitted, stored, previous) {
|
|
|
2469
2229
|
(key) => !WRITE_ONLY_SETTINGS_KEYS.includes(key) && !areSettingsEqual(source[key], stored?.[key]) && (previous === void 0 || !areSettingsEqual(source[key], previous?.[key]))
|
|
2470
2230
|
);
|
|
2471
2231
|
}
|
|
2472
|
-
const TABLE_MIN_WIDTH = 640;
|
|
2473
|
-
const keepActionKeys = (event) => {
|
|
2474
|
-
if (
|
|
2232
|
+
const TABLE_MIN_WIDTH$1 = 640;
|
|
2233
|
+
const keepActionKeys$1 = (event) => {
|
|
2234
|
+
if (settingsTabs.shouldIsolateActionKey(event.key, true)) event.stopPropagation();
|
|
2475
2235
|
};
|
|
2476
2236
|
const LockTarget = ({ lock }) => {
|
|
2477
|
-
const { t } = useSettingsTranslate();
|
|
2237
|
+
const { t } = index.useSettingsTranslate();
|
|
2478
2238
|
if (lock.kind === "ip") {
|
|
2479
2239
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2480
2240
|
designSystem.Typography,
|
|
@@ -2515,7 +2275,7 @@ const LockTarget = ({ lock }) => {
|
|
|
2515
2275
|
] });
|
|
2516
2276
|
};
|
|
2517
2277
|
const KindBadge = ({ kind }) => {
|
|
2518
|
-
const { t } = useSettingsTranslate();
|
|
2278
|
+
const { t } = index.useSettingsTranslate();
|
|
2519
2279
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "neutral150", textColor: "neutral800", children: kind === "ip" ? t("settings.lockouts.kind.ip", "IP address") : t("settings.lockouts.kind.account", "Account") });
|
|
2520
2280
|
};
|
|
2521
2281
|
const lockName = (lock, t) => {
|
|
@@ -2525,7 +2285,7 @@ const lockName = (lock, t) => {
|
|
|
2525
2285
|
return t("settings.lockouts.unknownAccount", "Account that does not exist");
|
|
2526
2286
|
};
|
|
2527
2287
|
const LockedNowCard = () => {
|
|
2528
|
-
const { t } = useSettingsTranslate();
|
|
2288
|
+
const { t } = index.useSettingsTranslate();
|
|
2529
2289
|
const { get, post } = StrapiAdmin.useFetchClient();
|
|
2530
2290
|
const { toggleNotification } = StrapiAdmin.useNotification();
|
|
2531
2291
|
const { formatDate } = index.useSessionFormatters();
|
|
@@ -2533,7 +2293,7 @@ const LockedNowCard = () => {
|
|
|
2533
2293
|
isLoading: permissionsLoading,
|
|
2534
2294
|
allowedActions: { canUnlock }
|
|
2535
2295
|
} = StrapiAdmin.useRBAC(index.pluginPermissions.lockoutsUnlock);
|
|
2536
|
-
const [widthRef, width] =
|
|
2296
|
+
const [widthRef, width] = settingsTabs.useElementWidth();
|
|
2537
2297
|
const [locks, setLocks] = react.useState(null);
|
|
2538
2298
|
const [error, setError] = react.useState(false);
|
|
2539
2299
|
const [refreshing, setRefreshing] = react.useState(false);
|
|
@@ -2590,7 +2350,7 @@ const LockedNowCard = () => {
|
|
|
2590
2350
|
}
|
|
2591
2351
|
};
|
|
2592
2352
|
const showActions = !permissionsLoading && canUnlock;
|
|
2593
|
-
const asTable = width === 0 || width >= TABLE_MIN_WIDTH;
|
|
2353
|
+
const asTable = width === 0 || width >= TABLE_MIN_WIDTH$1;
|
|
2594
2354
|
const unlockAction = (lock) => showActions ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2595
2355
|
index.ConfirmAction,
|
|
2596
2356
|
{
|
|
@@ -2657,7 +2417,7 @@ const LockedNowCard = () => {
|
|
|
2657
2417
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(KindBadge, { kind: lock.kind }) }),
|
|
2658
2418
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", children: lock.failures }) }),
|
|
2659
2419
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: ends(lock) }),
|
|
2660
|
-
showActions ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2420
|
+
showActions ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(settingsTabs.RowActions, { onKeyDown: keepActionKeys$1, children: unlockAction(lock) }) }) : null
|
|
2661
2421
|
] }, lock.id)) })
|
|
2662
2422
|
] }) });
|
|
2663
2423
|
} else {
|
|
@@ -2680,7 +2440,7 @@ const LockedNowCard = () => {
|
|
|
2680
2440
|
}) })
|
|
2681
2441
|
] })
|
|
2682
2442
|
] }),
|
|
2683
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2443
|
+
/* @__PURE__ */ jsxRuntime.jsx(settingsTabs.RowActions, { onKeyDown: keepActionKeys$1, children: unlockAction(lock) })
|
|
2684
2444
|
] })
|
|
2685
2445
|
},
|
|
2686
2446
|
lock.id
|
|
@@ -2739,7 +2499,7 @@ const LockedNowCard = () => {
|
|
|
2739
2499
|
);
|
|
2740
2500
|
};
|
|
2741
2501
|
const TrustedAddressesField = ({ form, disabled = false }) => {
|
|
2742
|
-
const { t, tError } = useSettingsTranslate();
|
|
2502
|
+
const { t, tError } = index.useSettingsTranslate();
|
|
2743
2503
|
const { settings, handleChange, errors, draftVersion } = form;
|
|
2744
2504
|
const [text, setText] = react.useState(
|
|
2745
2505
|
() => formatTrustedAddressText(settings.lockoutTrustedAddresses)
|
|
@@ -2776,7 +2536,7 @@ const TrustedAddressesField = ({ form, disabled = false }) => {
|
|
|
2776
2536
|
);
|
|
2777
2537
|
};
|
|
2778
2538
|
const ImpossibleTravelCard = ({ form }) => {
|
|
2779
|
-
const { t, tError } = useSettingsTranslate();
|
|
2539
|
+
const { t, tError } = index.useSettingsTranslate();
|
|
2780
2540
|
const { settings, handleChange, errors } = form;
|
|
2781
2541
|
const lookupOff = !settings.enableGeolocation;
|
|
2782
2542
|
const enabled = settings.impossibleTravelEnabled === true;
|
|
@@ -2852,7 +2612,7 @@ const ImpossibleTravelCard = ({ form }) => {
|
|
|
2852
2612
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2853
2613
|
AdvancedSection,
|
|
2854
2614
|
{
|
|
2855
|
-
hasError: fieldHasError(errors, "impossibleTravelSpeedKmh") || fieldHasError(errors, "impossibleTravelMinDistanceKm"),
|
|
2615
|
+
hasError: settingsTabs.fieldHasError(errors, "impossibleTravelSpeedKmh") || settingsTabs.fieldHasError(errors, "impossibleTravelMinDistanceKm"),
|
|
2856
2616
|
disabled: !enabled,
|
|
2857
2617
|
children: /* @__PURE__ */ jsxRuntime.jsxs(index.EqualGrid, { columns: 2, stackBelow: "medium", gap: 6, children: [
|
|
2858
2618
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3057,7 +2817,7 @@ const ChipList = styled__default.default(designSystem.Flex)`
|
|
|
3057
2817
|
}
|
|
3058
2818
|
`;
|
|
3059
2819
|
const CountryListEditor = ({ settings, handleChange }) => {
|
|
3060
|
-
const { t, tError, locale } = useSettingsTranslate();
|
|
2820
|
+
const { t, tError, locale } = index.useSettingsTranslate();
|
|
3061
2821
|
const modeLabelId = react.useId();
|
|
3062
2822
|
const listLabelId = react.useId();
|
|
3063
2823
|
const [mode, setMode] = react.useState(() => inferGeofencingMode(settings));
|
|
@@ -3340,7 +3100,7 @@ const describeLockout = (t, { ip, account, window: window2, duration }) => {
|
|
|
3340
3100
|
return parts.join(" ");
|
|
3341
3101
|
};
|
|
3342
3102
|
const LoginProtectionTab = ({ form }) => {
|
|
3343
|
-
const { t, tError } = useSettingsTranslate();
|
|
3103
|
+
const { t, tError } = index.useSettingsTranslate();
|
|
3344
3104
|
const { settings, handleChange, errors } = form;
|
|
3345
3105
|
const maxFailedError = tError(errors.maxFailedLogins);
|
|
3346
3106
|
const maxFailedValue = Number(settings.maxFailedLogins);
|
|
@@ -3357,8 +3117,8 @@ const LoginProtectionTab = ({ form }) => {
|
|
|
3357
3117
|
const lookupOff = !settings.enableGeolocation;
|
|
3358
3118
|
const locked = form.canChangeProtected === false;
|
|
3359
3119
|
const policyLocked = locked;
|
|
3360
|
-
const risk =
|
|
3361
|
-
const reject =
|
|
3120
|
+
const risk = settingsTabs.getRiskAvailability(form.geoIp.status);
|
|
3121
|
+
const reject = settingsTabs.riskDependentControl(settings.blockSuspiciousSessions, risk.state);
|
|
3362
3122
|
const autoStillRejects = reject.savedOnButInactive && (settings.geoLookupFailureMode || "auto") === "auto";
|
|
3363
3123
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
3364
3124
|
/* @__PURE__ */ jsxRuntime.jsx(IntroText, { children: t(
|
|
@@ -3537,7 +3297,7 @@ const LoginProtectionTab = ({ form }) => {
|
|
|
3537
3297
|
AdvancedSection,
|
|
3538
3298
|
{
|
|
3539
3299
|
label: t("settings.config.failed.trusted.section", "Trusted addresses"),
|
|
3540
|
-
hasError: fieldHasError(errors, "lockoutTrustedAddresses"),
|
|
3300
|
+
hasError: settingsTabs.fieldHasError(errors, "lockoutTrustedAddresses"),
|
|
3541
3301
|
children: /* @__PURE__ */ jsxRuntime.jsx(TrustedAddressesField, { form, disabled: policyLocked })
|
|
3542
3302
|
}
|
|
3543
3303
|
)
|
|
@@ -3608,7 +3368,7 @@ const LoginProtectionTab = ({ form }) => {
|
|
|
3608
3368
|
children: !lookupOff && reject.disabled ? /* @__PURE__ */ jsxRuntime.jsx(RiskSourceNotice, { savedOn: reject.savedOnButInactive }) : null
|
|
3609
3369
|
}
|
|
3610
3370
|
),
|
|
3611
|
-
/* @__PURE__ */ jsxRuntime.jsxs(AdvancedSection, { hasError: fieldHasError(errors, "geoLookupFailureMode"), children: [
|
|
3371
|
+
/* @__PURE__ */ jsxRuntime.jsxs(AdvancedSection, { hasError: settingsTabs.fieldHasError(errors, "geoLookupFailureMode"), children: [
|
|
3612
3372
|
/* @__PURE__ */ jsxRuntime.jsx(index.EqualGrid, { columns: 2, stackBelow: "medium", gap: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3613
3373
|
FormField,
|
|
3614
3374
|
{
|
|
@@ -3733,7 +3493,7 @@ const PathValue = ({ path }) => {
|
|
|
3733
3493
|
] }, index2)) });
|
|
3734
3494
|
};
|
|
3735
3495
|
const GeoIpDatabaseCard = ({ form }) => {
|
|
3736
|
-
const { t, tError, locale } = useSettingsTranslate();
|
|
3496
|
+
const { t, tError, locale } = index.useSettingsTranslate();
|
|
3737
3497
|
const { settings, handleChange, errors, hasChanges, geoIp } = form;
|
|
3738
3498
|
const geoIpStatus = geoIp.status;
|
|
3739
3499
|
const accountIdRef = react.useRef(null);
|
|
@@ -3750,7 +3510,7 @@ const GeoIpDatabaseCard = ({ form }) => {
|
|
|
3750
3510
|
};
|
|
3751
3511
|
const lookupOff = !settings.enableGeolocation;
|
|
3752
3512
|
const locked = form.canChangeProtected === false;
|
|
3753
|
-
const localDatabase = usesLocalDatabase(settings.geoIpProvider);
|
|
3513
|
+
const localDatabase = settingsTabs.usesLocalDatabase(settings.geoIpProvider);
|
|
3754
3514
|
const databaseDisabled = lookupOff || !localDatabase;
|
|
3755
3515
|
const credentialSource = geoIpStatus?.credentialSource;
|
|
3756
3516
|
const fromEnvironment = credentialSource === "env";
|
|
@@ -3967,7 +3727,7 @@ const GeoIpDatabaseCard = ({ form }) => {
|
|
|
3967
3727
|
"Save your changes first, so the download uses the current settings."
|
|
3968
3728
|
) }) : null
|
|
3969
3729
|
] }),
|
|
3970
|
-
/* @__PURE__ */ jsxRuntime.jsx(AdvancedSection, { hasError: fieldHasError(errors, "geoIpDatabasePath"), children: /* @__PURE__ */ jsxRuntime.jsx(index.EqualGrid, { columns: 2, stackBelow: "medium", gap: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3730
|
+
/* @__PURE__ */ jsxRuntime.jsx(AdvancedSection, { hasError: settingsTabs.fieldHasError(errors, "geoIpDatabasePath"), children: /* @__PURE__ */ jsxRuntime.jsx(index.EqualGrid, { columns: 2, stackBelow: "medium", gap: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3971
3731
|
FormField,
|
|
3972
3732
|
{
|
|
3973
3733
|
id: "geoip-database-filename",
|
|
@@ -4008,7 +3768,7 @@ const BADGE_COLOURS = Object.freeze({
|
|
|
4008
3768
|
missing: { backgroundColor: "neutral150", textColor: "neutral700" }
|
|
4009
3769
|
});
|
|
4010
3770
|
const RiskDatabase = ({ id, title, shortName, description, entry, form, lookupOff }) => {
|
|
4011
|
-
const { t, locale } = useSettingsTranslate();
|
|
3771
|
+
const { t, locale } = index.useSettingsTranslate();
|
|
4012
3772
|
const buttonRef = react.useRef(null);
|
|
4013
3773
|
const { geoIp } = form;
|
|
4014
3774
|
const state = databaseState(entry);
|
|
@@ -4067,10 +3827,10 @@ const RiskDatabase = ({ id, title, shortName, description, entry, form, lookupOf
|
|
|
4067
3827
|
);
|
|
4068
3828
|
};
|
|
4069
3829
|
const RiskDataCard = ({ form }) => {
|
|
4070
|
-
const { t } = useSettingsTranslate();
|
|
3830
|
+
const { t } = index.useSettingsTranslate();
|
|
4071
3831
|
const { settings, geoIp } = form;
|
|
4072
3832
|
const lookupOff = !settings.enableGeolocation;
|
|
4073
|
-
const risk =
|
|
3833
|
+
const risk = settingsTabs.getRiskAvailability(geoIp.status);
|
|
4074
3834
|
const sourceLabels = {
|
|
4075
3835
|
"anonymous-ip": t("settings.config.risk.source.anonymousIp", "Anonymous IP database"),
|
|
4076
3836
|
"asn-heuristic": t("settings.config.risk.source.asn", "ASN heuristic")
|
|
@@ -4135,10 +3895,10 @@ const RiskDataCard = ({ form }) => {
|
|
|
4135
3895
|
);
|
|
4136
3896
|
};
|
|
4137
3897
|
const LocationDataTab = ({ form }) => {
|
|
4138
|
-
const { t } = useSettingsTranslate();
|
|
3898
|
+
const { t } = index.useSettingsTranslate();
|
|
4139
3899
|
const { settings, handleChange } = form;
|
|
4140
|
-
const risk =
|
|
4141
|
-
const scoring =
|
|
3900
|
+
const risk = settingsTabs.getRiskAvailability(form.geoIp.status);
|
|
3901
|
+
const scoring = settingsTabs.riskDependentControl(settings.enableSecurityScoring, risk.state);
|
|
4142
3902
|
const locked = form.canChangeProtected === false;
|
|
4143
3903
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
4144
3904
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
|
@@ -4276,7 +4036,7 @@ const TEMPLATE_TAB_LABELS = {
|
|
|
4276
4036
|
};
|
|
4277
4037
|
const BlockLabel = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "bold", tag: "div", textColor: "neutral800", children });
|
|
4278
4038
|
const TemplateEditor = ({ templateKey, template, templates, handleChange, copyValue, errors }) => {
|
|
4279
|
-
const { t, tError } = useSettingsTranslate();
|
|
4039
|
+
const { t, tError } = index.useSettingsTranslate();
|
|
4280
4040
|
const { toggleNotification } = StrapiAdmin.useNotification();
|
|
4281
4041
|
const defaults = getDefaultTemplates()[templateKey];
|
|
4282
4042
|
const setField = (field, value) => {
|
|
@@ -4476,7 +4236,7 @@ const TemplateEditor = ({ templateKey, template, templates, handleChange, copyVa
|
|
|
4476
4236
|
] });
|
|
4477
4237
|
};
|
|
4478
4238
|
const EmailTemplatesCard = ({ form }) => {
|
|
4479
|
-
const { t } = useSettingsTranslate();
|
|
4239
|
+
const { t } = index.useSettingsTranslate();
|
|
4480
4240
|
const { settings, handleChange, copyValue, errors } = form;
|
|
4481
4241
|
const [activeTemplateTab, setActiveTemplateTab] = react.useState("suspiciousLogin");
|
|
4482
4242
|
const templates = settings.emailTemplates;
|
|
@@ -4554,7 +4314,7 @@ const WebhookUrlField = ({
|
|
|
4554
4314
|
error,
|
|
4555
4315
|
disabled = false
|
|
4556
4316
|
}) => {
|
|
4557
|
-
const { t } = useSettingsTranslate();
|
|
4317
|
+
const { t } = index.useSettingsTranslate();
|
|
4558
4318
|
const { settings, handleChange } = form;
|
|
4559
4319
|
const stored = settings[hasKey] === true;
|
|
4560
4320
|
const draft = settings[field];
|
|
@@ -4632,7 +4392,7 @@ const WriteOnlyField = ({
|
|
|
4632
4392
|
disabled = false,
|
|
4633
4393
|
extra
|
|
4634
4394
|
}) => {
|
|
4635
|
-
const { t, tError } = useSettingsTranslate();
|
|
4395
|
+
const { t, tError } = index.useSettingsTranslate();
|
|
4636
4396
|
const { settings, handleChange, errors } = form;
|
|
4637
4397
|
const draft = settings[field];
|
|
4638
4398
|
const [editing, setEditing] = react.useState(false);
|
|
@@ -4714,7 +4474,7 @@ const WriteOnlyField = ({
|
|
|
4714
4474
|
);
|
|
4715
4475
|
};
|
|
4716
4476
|
const SignedWebhookCard = ({ form }) => {
|
|
4717
|
-
const { t } = useSettingsTranslate();
|
|
4477
|
+
const { t } = index.useSettingsTranslate();
|
|
4718
4478
|
const { post } = StrapiAdmin.useFetchClient();
|
|
4719
4479
|
const { settings, handleChange } = form;
|
|
4720
4480
|
const [testing, setTesting] = react.useState(false);
|
|
@@ -4877,7 +4637,7 @@ const EventGrid = styled__default.default.div`
|
|
|
4877
4637
|
}
|
|
4878
4638
|
`;
|
|
4879
4639
|
const WebhookEventsCard = ({ form }) => {
|
|
4880
|
-
const { t } = useSettingsTranslate();
|
|
4640
|
+
const { t } = index.useSettingsTranslate();
|
|
4881
4641
|
const { settings, handleChange } = form;
|
|
4882
4642
|
const locked = form.canChangeProtected === false;
|
|
4883
4643
|
const selected = Array.isArray(settings.webhookEvents) ? settings.webhookEvents : [];
|
|
@@ -4946,7 +4706,7 @@ const AlertTypeCell = ({ checked, disabled, children }) => /* @__PURE__ */ jsxRu
|
|
|
4946
4706
|
}
|
|
4947
4707
|
);
|
|
4948
4708
|
const AlertsTab = ({ form }) => {
|
|
4949
|
-
const { t, tError } = useSettingsTranslate();
|
|
4709
|
+
const { t, tError } = index.useSettingsTranslate();
|
|
4950
4710
|
const { settings, handleChange, errors } = form;
|
|
4951
4711
|
const hintIds = {
|
|
4952
4712
|
suspicious: react.useId(),
|
|
@@ -4959,8 +4719,8 @@ const AlertsTab = ({ form }) => {
|
|
|
4959
4719
|
const emailTypesDisabled = lookupOff || !settings.enableEmailAlerts;
|
|
4960
4720
|
const webhookFieldsDisabled = lookupOff || !settings.enableWebhooks;
|
|
4961
4721
|
const locked = form.canChangeProtected === false;
|
|
4962
|
-
const templateErrors = fieldHasError(errors, "emailTemplates");
|
|
4963
|
-
const risk =
|
|
4722
|
+
const templateErrors = settingsTabs.fieldHasError(errors, "emailTemplates");
|
|
4723
|
+
const risk = settingsTabs.getRiskAvailability(form.geoIp.status);
|
|
4964
4724
|
const emailTypes = [
|
|
4965
4725
|
{
|
|
4966
4726
|
field: "alertOnSuspiciousLogin",
|
|
@@ -5047,7 +4807,7 @@ const AlertsTab = ({ form }) => {
|
|
|
5047
4807
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", tag: "div", textColor: "neutral800", children: t("settings.config.email.types.label", "Send an email for") }),
|
|
5048
4808
|
!lookupOff && !settings.enableEmailAlerts ? /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { children: t("settings.config.requires.emailAlerts", "Requires Send security emails") }) : null,
|
|
5049
4809
|
/* @__PURE__ */ jsxRuntime.jsx(EmailTypeGrid, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: emailTypes.map(({ field, needsRiskData, needsTravel, hintId, label, hint }) => {
|
|
5050
|
-
const control = needsRiskData ?
|
|
4810
|
+
const control = needsRiskData ? settingsTabs.riskDependentControl(settings[field], risk.state) : { checked: settings[field], disabled: false, savedOnButInactive: false };
|
|
5051
4811
|
const travelOff = needsTravel && settings.impossibleTravelEnabled !== true;
|
|
5052
4812
|
const disabled = emailTypesDisabled || control.disabled || travelOff;
|
|
5053
4813
|
return /* @__PURE__ */ jsxRuntime.jsxs(AlertTypeCell, { checked: control.checked, disabled, children: [
|
|
@@ -5174,7 +4934,7 @@ const DangerButton = styled__default.default(designSystem.Button)`
|
|
|
5174
4934
|
white-space: nowrap;
|
|
5175
4935
|
`;
|
|
5176
4936
|
const DataRetentionTab = ({ form }) => {
|
|
5177
|
-
const { t } = useSettingsTranslate();
|
|
4937
|
+
const { t } = index.useSettingsTranslate();
|
|
5178
4938
|
const units = useOptionLabels();
|
|
5179
4939
|
const { settings, handleChange, handleCleanInactive } = form;
|
|
5180
4940
|
const {
|
|
@@ -5235,7 +4995,7 @@ const DataRetentionTab = ({ form }) => {
|
|
|
5235
4995
|
"Checked once a day, the first time about 24 hours after the server starts. Open sessions are never deleted by retention. 'Forever' keeps them."
|
|
5236
4996
|
),
|
|
5237
4997
|
value: settings.retentionDays,
|
|
5238
|
-
presets: SELECT_PRESETS.retentionDays,
|
|
4998
|
+
presets: settingsTabs.SELECT_PRESETS.retentionDays,
|
|
5239
4999
|
format: units.retentionDays,
|
|
5240
5000
|
onChange: (value) => handleChange("retentionDays", value)
|
|
5241
5001
|
}
|
|
@@ -5314,7 +5074,7 @@ const DataRetentionTab = ({ form }) => {
|
|
|
5314
5074
|
] });
|
|
5315
5075
|
};
|
|
5316
5076
|
const AdminActivityTab = ({ form }) => {
|
|
5317
|
-
const { t } = useSettingsTranslate();
|
|
5077
|
+
const { t } = index.useSettingsTranslate();
|
|
5318
5078
|
const units = useOptionLabels();
|
|
5319
5079
|
const { settings, handleChange } = form;
|
|
5320
5080
|
const locked = form.canChangeProtected === false;
|
|
@@ -5431,7 +5191,7 @@ const AdminActivityTab = ({ form }) => {
|
|
|
5431
5191
|
"At least 7 days. Older events are deleted once a day; each deletion is itself recorded. Events of a deleted admin are deleted with the account."
|
|
5432
5192
|
),
|
|
5433
5193
|
value: settings.securityLogRetentionDays,
|
|
5434
|
-
presets: SELECT_PRESETS.securityLogRetentionDays,
|
|
5194
|
+
presets: settingsTabs.SELECT_PRESETS.securityLogRetentionDays,
|
|
5435
5195
|
format: units.days,
|
|
5436
5196
|
disabled: locked,
|
|
5437
5197
|
onChange: (value) => handleChange("securityLogRetentionDays", value)
|
|
@@ -5442,15 +5202,239 @@ const AdminActivityTab = ({ form }) => {
|
|
|
5442
5202
|
)
|
|
5443
5203
|
] });
|
|
5444
5204
|
};
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5205
|
+
const TABLE_MIN_WIDTH = 720;
|
|
5206
|
+
const keepActionKeys = (event) => {
|
|
5207
|
+
if (settingsTabs.shouldIsolateActionKey(event.key, true)) event.stopPropagation();
|
|
5208
|
+
};
|
|
5209
|
+
const ActiveImpersonationsCard = () => {
|
|
5210
|
+
const { t } = index.useSettingsTranslate();
|
|
5211
|
+
const { get, post } = StrapiAdmin.useFetchClient();
|
|
5212
|
+
const { toggleNotification } = StrapiAdmin.useNotification();
|
|
5213
|
+
const { formatDate } = index.useSessionFormatters();
|
|
5214
|
+
const [widthRef, width] = settingsTabs.useElementWidth();
|
|
5215
|
+
const [rows, setRows] = react.useState(null);
|
|
5216
|
+
const [error, setError] = react.useState(false);
|
|
5217
|
+
const [refreshing, setRefreshing] = react.useState(false);
|
|
5218
|
+
const refreshRef = react.useRef(null);
|
|
5219
|
+
const requestRef = react.useRef(0);
|
|
5220
|
+
const apply = react.useCallback(async (request, pending) => {
|
|
5221
|
+
try {
|
|
5222
|
+
const { data } = await pending;
|
|
5223
|
+
if (request !== requestRef.current) return;
|
|
5224
|
+
if (!Array.isArray(data?.data)) throw new Error("Invalid impersonation list");
|
|
5225
|
+
setRows(data.data);
|
|
5226
|
+
setError(false);
|
|
5227
|
+
} catch (err) {
|
|
5228
|
+
if (index.isCancelledRequest(err) || request !== requestRef.current) return;
|
|
5229
|
+
index.logSafeAdminError("impersonation.list", err);
|
|
5230
|
+
setError(true);
|
|
5231
|
+
} finally {
|
|
5232
|
+
if (request === requestRef.current) setRefreshing(false);
|
|
5233
|
+
}
|
|
5234
|
+
}, []);
|
|
5235
|
+
const load = react.useCallback(() => {
|
|
5236
|
+
const request = ++requestRef.current;
|
|
5237
|
+
setRefreshing(true);
|
|
5238
|
+
return apply(request, get(`/${index.pluginId}/impersonation/active`));
|
|
5239
|
+
}, [apply, get]);
|
|
5240
|
+
react.useEffect(() => {
|
|
5241
|
+
apply(++requestRef.current, get(`/${index.pluginId}/impersonation/active`));
|
|
5242
|
+
}, [apply, get]);
|
|
5243
|
+
const end = async (row) => {
|
|
5244
|
+
try {
|
|
5245
|
+
await post(`/${index.pluginId}/impersonation/${row.id}/end`, {});
|
|
5246
|
+
toggleNotification({
|
|
5247
|
+
type: "success",
|
|
5248
|
+
message: t("impersonation.ended", "Impersonation ended.")
|
|
5249
|
+
});
|
|
5250
|
+
} catch (err) {
|
|
5251
|
+
index.logSafeAdminError("impersonation.end", err);
|
|
5252
|
+
toggleNotification({
|
|
5253
|
+
type: "danger",
|
|
5254
|
+
message: t("impersonation.error.end", "The impersonation could not be ended.")
|
|
5255
|
+
});
|
|
5256
|
+
throw err;
|
|
5257
|
+
} finally {
|
|
5258
|
+
await load();
|
|
5259
|
+
}
|
|
5260
|
+
};
|
|
5261
|
+
const endAction = (row) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5262
|
+
index.ConfirmAction,
|
|
5263
|
+
{
|
|
5264
|
+
fallbackFocusRef: refreshRef,
|
|
5265
|
+
title: t("impersonation.confirm.title", "End the impersonation of {user}?", {
|
|
5266
|
+
user: row.targetLabel
|
|
5267
|
+
}),
|
|
5268
|
+
body: t(
|
|
5269
|
+
"impersonation.confirm.body",
|
|
5270
|
+
"The short-lived sign-in stops working at once. This is recorded in the security log."
|
|
5271
|
+
),
|
|
5272
|
+
confirmLabel: t("impersonation.end", "End impersonation"),
|
|
5273
|
+
onConfirm: () => end(row),
|
|
5274
|
+
trigger: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5275
|
+
designSystem.IconButton,
|
|
5276
|
+
{
|
|
5277
|
+
variant: "ghost",
|
|
5278
|
+
label: t("impersonation.endLabel", "End impersonation of {user}", {
|
|
5279
|
+
user: row.targetLabel
|
|
5280
|
+
}),
|
|
5281
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.SignOut, {})
|
|
5282
|
+
}
|
|
5283
|
+
)
|
|
5284
|
+
},
|
|
5285
|
+
row.id
|
|
5286
|
+
);
|
|
5287
|
+
const time = (iso) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "time", dateTime: iso, variant: "omega", textColor: "neutral800", children: formatDate(iso, { hour: "2-digit", minute: "2-digit" }) });
|
|
5288
|
+
const startedBy = (row) => row.startedByYou ? t("impersonation.list.you", "You") : row.actorLabel || "—";
|
|
5289
|
+
let content;
|
|
5290
|
+
if (rows === null && !error) {
|
|
5291
|
+
content = /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", padding: 6, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { small: true, children: t("impersonation.list.loading", "Loading impersonations…") }) });
|
|
5292
|
+
} else if (error && rows === null) {
|
|
5293
|
+
content = /* @__PURE__ */ jsxRuntime.jsx(
|
|
5294
|
+
index.PersistentAlert,
|
|
5295
|
+
{
|
|
5296
|
+
variant: "danger",
|
|
5297
|
+
closeLabel: t("common.close", "Close"),
|
|
5298
|
+
title: t("impersonation.list.error", "Impersonations could not be loaded."),
|
|
5299
|
+
action: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", onClick: load, children: t("common.tryAgain", "Try again") }),
|
|
5300
|
+
children: t(
|
|
5301
|
+
"impersonation.list.errorBody",
|
|
5302
|
+
"Running impersonations still end on time; only this list is missing."
|
|
5303
|
+
)
|
|
5304
|
+
}
|
|
5305
|
+
);
|
|
5306
|
+
} else if (rows.length === 0) {
|
|
5307
|
+
content = /* @__PURE__ */ jsxRuntime.jsx(
|
|
5308
|
+
designSystem.EmptyStateLayout,
|
|
5309
|
+
{
|
|
5310
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyPermissions, { width: "16rem", height: "8rem" }),
|
|
5311
|
+
content: t(
|
|
5312
|
+
"impersonation.list.empty",
|
|
5313
|
+
"No impersonation is running. Start one from a user’s entry in the Content Manager."
|
|
5314
|
+
)
|
|
5315
|
+
}
|
|
5316
|
+
);
|
|
5317
|
+
} else if (width === 0 || width >= TABLE_MIN_WIDTH) {
|
|
5318
|
+
content = /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { hasRadius: true, borderColor: "neutral150", "data-impersonations-table": "", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { colCount: 5, rowCount: rows.length + 1, "aria-busy": refreshing, children: [
|
|
5319
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
5320
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", children: t("impersonation.list.col.user", "User") }) }),
|
|
5321
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", children: t("impersonation.list.col.startedBy", "Started by") }) }),
|
|
5322
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", children: t("impersonation.list.col.reason", "Reason") }) }),
|
|
5323
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", children: t("impersonation.list.col.ends", "Ends") }) }),
|
|
5324
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { children: t("impersonation.list.col.actions", "Actions") }) })
|
|
5325
|
+
] }) }),
|
|
5326
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { "data-impersonation-row": "", children: [
|
|
5327
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", fontWeight: "semiBold", children: row.targetLabel }) }),
|
|
5328
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", children: startedBy(row) }) }),
|
|
5329
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { style: { maxWidth: 0, width: "40%" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5330
|
+
designSystem.Typography,
|
|
5331
|
+
{
|
|
5332
|
+
variant: "omega",
|
|
5333
|
+
textColor: "neutral800",
|
|
5334
|
+
tag: "p",
|
|
5335
|
+
style: { overflowWrap: "anywhere" },
|
|
5336
|
+
children: row.reason
|
|
5337
|
+
}
|
|
5338
|
+
) }),
|
|
5339
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: time(row.expiresAt) }),
|
|
5340
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(settingsTabs.RowActions, { onKeyDown: keepActionKeys, children: endAction(row) }) })
|
|
5341
|
+
] }, row.id)) })
|
|
5342
|
+
] }) });
|
|
5343
|
+
} else {
|
|
5344
|
+
content = /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, tag: "ul", "data-impersonations-list": "", children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { tag: "li", padding: 4, hasRadius: true, borderColor: "neutral150", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "flex-start", gap: 3, children: [
|
|
5345
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 1, minWidth: 0, children: [
|
|
5346
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", fontWeight: "semiBold", children: row.targetLabel }),
|
|
5347
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5348
|
+
designSystem.Typography,
|
|
5349
|
+
{
|
|
5350
|
+
variant: "pi",
|
|
5351
|
+
textColor: "neutral800",
|
|
5352
|
+
tag: "p",
|
|
5353
|
+
style: { overflowWrap: "anywhere" },
|
|
5354
|
+
children: row.reason
|
|
5355
|
+
}
|
|
5356
|
+
),
|
|
5357
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t("impersonation.list.summary", "{admin}, until {time}", {
|
|
5358
|
+
admin: startedBy(row),
|
|
5359
|
+
time: formatDate(row.expiresAt, { hour: "2-digit", minute: "2-digit" })
|
|
5360
|
+
}) })
|
|
5361
|
+
] }),
|
|
5362
|
+
/* @__PURE__ */ jsxRuntime.jsx(settingsTabs.RowActions, { onKeyDown: keepActionKeys, children: endAction(row) })
|
|
5363
|
+
] }) }, row.id)) });
|
|
5451
5364
|
}
|
|
5452
|
-
|
|
5453
|
-
|
|
5365
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5366
|
+
SectionCard.SectionCard,
|
|
5367
|
+
{
|
|
5368
|
+
id: "active-impersonations",
|
|
5369
|
+
title: t("impersonation.list.title", "Active impersonations"),
|
|
5370
|
+
subtitle: t(
|
|
5371
|
+
"impersonation.list.intro",
|
|
5372
|
+
"Each one ends by itself at the time shown. End stops it at once."
|
|
5373
|
+
),
|
|
5374
|
+
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5375
|
+
designSystem.Button,
|
|
5376
|
+
{
|
|
5377
|
+
ref: refreshRef,
|
|
5378
|
+
variant: "tertiary",
|
|
5379
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowClockwise, {}),
|
|
5380
|
+
onClick: load,
|
|
5381
|
+
loading: refreshing && rows !== null,
|
|
5382
|
+
children: t("impersonation.list.refresh", "Refresh")
|
|
5383
|
+
}
|
|
5384
|
+
),
|
|
5385
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: widthRef, "aria-live": "polite", children: [
|
|
5386
|
+
error && rows !== null ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 3, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5387
|
+
index.PersistentAlert,
|
|
5388
|
+
{
|
|
5389
|
+
variant: "warning",
|
|
5390
|
+
closeLabel: t("common.close", "Close"),
|
|
5391
|
+
title: t("impersonation.list.refreshErrorTitle", "Not refreshed"),
|
|
5392
|
+
children: t(
|
|
5393
|
+
"impersonation.list.refreshError",
|
|
5394
|
+
"The list could not be refreshed. It shows the last known impersonations."
|
|
5395
|
+
)
|
|
5396
|
+
}
|
|
5397
|
+
) }) : null,
|
|
5398
|
+
content
|
|
5399
|
+
] })
|
|
5400
|
+
}
|
|
5401
|
+
);
|
|
5402
|
+
};
|
|
5403
|
+
const ImpersonationTab = ({ form }) => {
|
|
5404
|
+
const { t } = index.useSettingsTranslate();
|
|
5405
|
+
const { settings, handleChange } = form;
|
|
5406
|
+
const locked = form.canChangeProtected === false;
|
|
5407
|
+
const {
|
|
5408
|
+
isLoading,
|
|
5409
|
+
allowedActions: { canUsers }
|
|
5410
|
+
} = StrapiAdmin.useRBAC(index.pluginPermissions.impersonateUsers);
|
|
5411
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
5412
|
+
/* @__PURE__ */ jsxRuntime.jsx(IntroText, { children: t(
|
|
5413
|
+
"settings.impersonation.intro",
|
|
5414
|
+
"Support staff can act as an app user for up to an hour to reproduce a problem, with a reason that is recorded. Who may do this is set per role under Settings > Roles > Session Manager."
|
|
5415
|
+
) }),
|
|
5416
|
+
locked ? /* @__PURE__ */ jsxRuntime.jsx(ProtectedNotice, {}) : null,
|
|
5417
|
+
/* @__PURE__ */ jsxRuntime.jsx(SectionCard.SectionCard, { title: t("settings.impersonation.title", "Impersonation of app users"), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5418
|
+
SettingsToggleRow,
|
|
5419
|
+
{
|
|
5420
|
+
id: "impersonation-enabled",
|
|
5421
|
+
title: t("settings.impersonation.enable.label", "Allow impersonation"),
|
|
5422
|
+
description: t(
|
|
5423
|
+
"settings.impersonation.enable.hint",
|
|
5424
|
+
"Off by default. Turning it off ends every running impersonation at once."
|
|
5425
|
+
),
|
|
5426
|
+
checked: settings.impersonationEnabled === true,
|
|
5427
|
+
disabled: locked,
|
|
5428
|
+
onChange: (checked) => handleChange("impersonationEnabled", checked),
|
|
5429
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(index.ReadableText, { variant: "pi", textColor: "neutral700", tag: "p", "data-privacy-note": "", children: t(
|
|
5430
|
+
"settings.impersonation.notice",
|
|
5431
|
+
"Acting as a person processes their personal data. Tell your users in the privacy notice, and in Germany check whether the works council must agree, because the log shows what each admin did."
|
|
5432
|
+
) })
|
|
5433
|
+
}
|
|
5434
|
+
) }),
|
|
5435
|
+
!isLoading && canUsers ? /* @__PURE__ */ jsxRuntime.jsx(ActiveImpersonationsCard, {}) : null
|
|
5436
|
+
] });
|
|
5437
|
+
};
|
|
5454
5438
|
const INITIAL_SETTINGS = { ...SETTINGS_DEFAULTS, emailTemplates: fillMissingTemplates({}) };
|
|
5455
5439
|
const BUILD_DATE_OPTIONS = Object.freeze({ dateStyle: "medium" });
|
|
5456
5440
|
const getServerMessage = (error) => {
|
|
@@ -5467,7 +5451,7 @@ const formatList = (names, locale) => {
|
|
|
5467
5451
|
}
|
|
5468
5452
|
};
|
|
5469
5453
|
function useSettingsForm() {
|
|
5470
|
-
const { t, locale } = useSettingsTranslate();
|
|
5454
|
+
const { t, locale } = index.useSettingsTranslate();
|
|
5471
5455
|
const { get, post, put } = StrapiAdmin.useFetchClient();
|
|
5472
5456
|
const { toggleNotification } = StrapiAdmin.useNotification();
|
|
5473
5457
|
const [loading, setLoading] = react.useState(true);
|
|
@@ -5486,7 +5470,7 @@ function useSettingsForm() {
|
|
|
5486
5470
|
const hasChanges = !areSettingsEqual(settings, savedSettings);
|
|
5487
5471
|
const errors = react.useMemo(() => validateSettings(settings), [settings]);
|
|
5488
5472
|
const errorCount = Object.keys(errors).length;
|
|
5489
|
-
const errorTab = getErrorTab(errors);
|
|
5473
|
+
const errorTab = settingsTabs.getErrorTab(errors);
|
|
5490
5474
|
const canSave = hasChanges && errorCount === 0 && !saving;
|
|
5491
5475
|
const settingsRef = react.useRef(settings);
|
|
5492
5476
|
const savedSettingsRef = react.useRef(savedSettings);
|
|
@@ -5499,7 +5483,7 @@ function useSettingsForm() {
|
|
|
5499
5483
|
const copyValue = react.useCallback(
|
|
5500
5484
|
async (value, successMessage, scope) => {
|
|
5501
5485
|
try {
|
|
5502
|
-
await copyText(value);
|
|
5486
|
+
await index.copyText(value);
|
|
5503
5487
|
toggleNotification({ type: "success", message: successMessage });
|
|
5504
5488
|
} catch (error) {
|
|
5505
5489
|
index.logSafeAdminError(scope, error);
|
|
@@ -5578,7 +5562,7 @@ function useSettingsForm() {
|
|
|
5578
5562
|
});
|
|
5579
5563
|
}, []);
|
|
5580
5564
|
const handleSave = react.useCallback(async () => {
|
|
5581
|
-
const submitted = buildSavePayload(settingsRef.current, savedSettingsRef.current);
|
|
5565
|
+
const submitted = settingsTabs.buildSavePayload(settingsRef.current, savedSettingsRef.current);
|
|
5582
5566
|
const previous = savedSettingsRef.current;
|
|
5583
5567
|
if (Object.keys(validateSettings(submitted)).length > 0) return false;
|
|
5584
5568
|
setSaving(true);
|
|
@@ -5598,7 +5582,7 @@ function useSettingsForm() {
|
|
|
5598
5582
|
setDraftVersion((version) => version + 1);
|
|
5599
5583
|
const adjustedNames = [
|
|
5600
5584
|
...new Set(
|
|
5601
|
-
getAdjustedFields(submitted, stored, previous).map((key) => SETTINGS_FIELD_LABELS[key]).filter(Boolean).map(([id, defaultMessage]) => t(id, defaultMessage))
|
|
5585
|
+
getAdjustedFields(submitted, stored, previous).map((key) => settingsTabs.SETTINGS_FIELD_LABELS[key]).filter(Boolean).map(([id, defaultMessage]) => t(id, defaultMessage))
|
|
5602
5586
|
)
|
|
5603
5587
|
];
|
|
5604
5588
|
toggleNotification({
|
|
@@ -5822,6 +5806,7 @@ const TAB_COMPONENTS = {
|
|
|
5822
5806
|
"location-data": LocationDataTab,
|
|
5823
5807
|
alerts: AlertsTab,
|
|
5824
5808
|
"data-retention": DataRetentionTab,
|
|
5809
|
+
impersonation: ImpersonationTab,
|
|
5825
5810
|
"admin-activity": AdminActivityTab
|
|
5826
5811
|
};
|
|
5827
5812
|
const DraftSync = ({ values }) => {
|
|
@@ -5834,12 +5819,12 @@ const DraftSync = ({ values }) => {
|
|
|
5834
5819
|
const writeTabToAddressBar = (tab) => {
|
|
5835
5820
|
if (typeof window === "undefined" || !window.history?.replaceState) return;
|
|
5836
5821
|
const { pathname, search, hash } = window.location;
|
|
5837
|
-
const nextSearch = buildTabSearch(search, tab);
|
|
5822
|
+
const nextSearch = settingsTabs.buildTabSearch(search, tab);
|
|
5838
5823
|
if (nextSearch === search) return;
|
|
5839
5824
|
window.history.replaceState(window.history.state, "", `${pathname}${nextSearch}${hash}`);
|
|
5840
5825
|
};
|
|
5841
5826
|
const SettingsPage = () => {
|
|
5842
|
-
const { t } = useSettingsTranslate();
|
|
5827
|
+
const { t } = index.useSettingsTranslate();
|
|
5843
5828
|
const form = useSettingsForm();
|
|
5844
5829
|
const [{ query }] = StrapiAdmin.useQueryParams();
|
|
5845
5830
|
const {
|
|
@@ -5849,10 +5834,10 @@ const SettingsPage = () => {
|
|
|
5849
5834
|
allowedActions: { canUpdate: canChangeProtected }
|
|
5850
5835
|
} = StrapiAdmin.useRBAC(index.pluginPermissions.settingsUpdate);
|
|
5851
5836
|
const visibleTabs = react.useMemo(
|
|
5852
|
-
() => getVisibleSettingsTabs(Boolean(canViewAdminActivity)),
|
|
5837
|
+
() => settingsTabs.getVisibleSettingsTabs(Boolean(canViewAdminActivity)),
|
|
5853
5838
|
[canViewAdminActivity]
|
|
5854
5839
|
);
|
|
5855
|
-
const requestedTab = resolveSettingsTab(query?.tab, visibleTabs);
|
|
5840
|
+
const requestedTab = settingsTabs.resolveSettingsTab(query?.tab, visibleTabs);
|
|
5856
5841
|
const [activeTab, setActiveTab] = react.useState(requestedTab);
|
|
5857
5842
|
const [followedTab, setFollowedTab] = react.useState(requestedTab);
|
|
5858
5843
|
const tabsRef = react.useRef(null);
|
|
@@ -5864,7 +5849,7 @@ const SettingsPage = () => {
|
|
|
5864
5849
|
const list = tabsRef.current?.querySelector('[role="tablist"]');
|
|
5865
5850
|
const tab = list?.querySelector('[role="tab"][aria-selected="true"]');
|
|
5866
5851
|
if (!list || !tab) return;
|
|
5867
|
-
const delta = getRevealScrollDelta(list.getBoundingClientRect(), tab.getBoundingClientRect());
|
|
5852
|
+
const delta = settingsTabs.getRevealScrollDelta(list.getBoundingClientRect(), tab.getBoundingClientRect());
|
|
5868
5853
|
if (delta) list.scrollLeft += delta;
|
|
5869
5854
|
}, [activeTab, form.loading]);
|
|
5870
5855
|
const focusActiveTab = react.useCallback(() => {
|
|
@@ -5881,7 +5866,7 @@ const SettingsPage = () => {
|
|
|
5881
5866
|
}, [handleSave, focusActiveTab]);
|
|
5882
5867
|
const changeTab = react.useCallback(
|
|
5883
5868
|
(tab) => {
|
|
5884
|
-
const next = resolveSettingsTab(tab, visibleTabs);
|
|
5869
|
+
const next = settingsTabs.resolveSettingsTab(tab, visibleTabs);
|
|
5885
5870
|
setActiveTab(next);
|
|
5886
5871
|
writeTabToAddressBar(next);
|
|
5887
5872
|
},
|
|
@@ -5971,7 +5956,7 @@ const SettingsPage = () => {
|
|
|
5971
5956
|
SettingsTabsList,
|
|
5972
5957
|
{
|
|
5973
5958
|
"aria-label": t("settings.config.tabs.label", "Configuration sections"),
|
|
5974
|
-
children: visibleTabs.map((tab) => /* @__PURE__ */ jsxRuntime.jsx(SettingsTabTrigger, { value: tab, children: /* @__PURE__ */ jsxRuntime.jsx(SettingsTabLabel, { children: t(SETTINGS_TAB_LABELS[tab][0], SETTINGS_TAB_LABELS[tab][1]) }) }, tab))
|
|
5959
|
+
children: visibleTabs.map((tab) => /* @__PURE__ */ jsxRuntime.jsx(SettingsTabTrigger, { value: tab, children: /* @__PURE__ */ jsxRuntime.jsx(SettingsTabLabel, { children: t(settingsTabs.SETTINGS_TAB_LABELS[tab][0], settingsTabs.SETTINGS_TAB_LABELS[tab][1]) }) }, tab))
|
|
5975
5960
|
}
|
|
5976
5961
|
),
|
|
5977
5962
|
visibleTabs.map((tab) => {
|