strapi-plugin-magic-sessionmanager 4.16.0 → 4.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/README.md +42 -28
- package/dist/admin/{Analytics-me4qzS0I.js → Analytics-CMR62DiD.js} +1 -1
- package/dist/admin/{Analytics-D4gsVwL0.mjs → Analytics-FcRt0X62.mjs} +1 -1
- package/dist/admin/{App-BTG-2Q26.js → App-CmytGbze.js} +80 -15
- package/dist/admin/{App-BJwtFWxl.mjs → App-DBieSWB0.mjs} +80 -15
- package/dist/admin/{OnlineUsersWidget-DYS3Vy1Q.js → OnlineUsersWidget-Lzx9XB74.js} +1 -1
- package/dist/admin/{OnlineUsersWidget-Yd283YDy.mjs → OnlineUsersWidget-zP9Hl_it.mjs} +1 -1
- package/dist/admin/{Settings-TPZ9_75s.js → Settings-1v--SXC0.js} +185 -54
- package/dist/admin/{Settings-DIlvfdjZ.mjs → Settings-CZOPusQK.mjs} +185 -54
- package/dist/admin/{de-DB9ldYwN.mjs → de-D3TSA066.mjs} +17 -3
- package/dist/admin/{de-BuMw1gBJ.js → de-y_9mdVT7.js} +17 -3
- package/dist/admin/{en-BbLMPQB3.mjs → en-B60I97bK.mjs} +17 -3
- package/dist/admin/{en-BqGhOJDy.js → en-CIQB8nfI.js} +17 -3
- package/dist/admin/{es-C5iaiE9G.mjs → es-CJEL_iGC.mjs} +17 -3
- package/dist/admin/{es-BaIeckl9.js → es-DHhHzlRY.js} +17 -3
- package/dist/admin/{fr-BEvBUCwI.mjs → fr-BfBK_iuV.mjs} +17 -3
- package/dist/admin/{fr-D1YKyTex.js → fr-D86FTt1w.js} +17 -3
- package/dist/admin/{index-CgZiLcJ1.js → index-CSJJn4qy.js} +15 -10
- package/dist/admin/{index-DUESEUaO.mjs → index-tt61o2VH.mjs} +15 -10
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/{pt-DtnW-s0V.js → pt-BE-FT-L8.js} +17 -3
- package/dist/admin/{pt-DeDih9cR.mjs → pt-C3PSvC7z.mjs} +17 -3
- package/dist/server/index.js +2643 -1800
- package/dist/server/index.mjs +2643 -1800
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ 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-
|
|
9
|
+
const index = require("./index-CSJJn4qy.js");
|
|
10
10
|
const reactIntl = require("react-intl");
|
|
11
11
|
const SectionCard = require("./SectionCard-BlWv8CRt.js");
|
|
12
12
|
const riskData = require("./riskData-BVs9GpgD.js");
|
|
@@ -71,6 +71,7 @@ const SETTINGS_TAB_FIELDS = Object.freeze({
|
|
|
71
71
|
"adminContentActivity",
|
|
72
72
|
"securityLogStoreIp",
|
|
73
73
|
"securityLogAnonymizeIp",
|
|
74
|
+
"securityLogGeoLookup",
|
|
74
75
|
"securityLogRetentionDays"
|
|
75
76
|
]
|
|
76
77
|
});
|
|
@@ -126,6 +127,10 @@ const SETTINGS_FIELD_LABELS = Object.freeze({
|
|
|
126
127
|
"settings.config.adminActivity.anonymize.label",
|
|
127
128
|
"Anonymise the last part of IP addresses"
|
|
128
129
|
],
|
|
130
|
+
securityLogGeoLookup: [
|
|
131
|
+
"settings.config.adminActivity.geoLookup.label",
|
|
132
|
+
"Look up the location of security events"
|
|
133
|
+
],
|
|
129
134
|
securityLogRetentionDays: [
|
|
130
135
|
"settings.config.adminActivity.retention.label",
|
|
131
136
|
"Keep security events for"
|
|
@@ -620,6 +625,13 @@ function useOptionLabels() {
|
|
|
620
625
|
}
|
|
621
626
|
const IntroText = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(index.ReadableText, { variant: "omega", textColor: "neutral600", tag: "p", children });
|
|
622
627
|
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 });
|
|
628
|
+
const ProtectedNotice = () => {
|
|
629
|
+
const { t } = useSettingsTranslate();
|
|
630
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { children: t(
|
|
631
|
+
"settings.config.protected.notice",
|
|
632
|
+
"Read-only for your role: changing this needs the “Change protected settings” permission."
|
|
633
|
+
) });
|
|
634
|
+
};
|
|
623
635
|
const RequiresGeolocation = () => {
|
|
624
636
|
const { t } = useSettingsTranslate();
|
|
625
637
|
return /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { tab: "location-data", children: t("settings.config.requires.geolocation", "Requires IP location lookup") });
|
|
@@ -1402,8 +1414,13 @@ const SETTINGS_DEFAULTS = Object.freeze({
|
|
|
1402
1414
|
alertOnNewLocation: true,
|
|
1403
1415
|
alertOnVpnProxy: true,
|
|
1404
1416
|
enableWebhooks: false,
|
|
1405
|
-
|
|
1406
|
-
|
|
1417
|
+
// Webhook URLs are never returned (4.17): the API sends hasDiscordWebhook /
|
|
1418
|
+
// hasSlackWebhook and a hint; a URL key exists in the draft only while the
|
|
1419
|
+
// admin replaces (text) or removes ('') it.
|
|
1420
|
+
hasDiscordWebhook: false,
|
|
1421
|
+
hasSlackWebhook: false,
|
|
1422
|
+
discordWebhookHint: null,
|
|
1423
|
+
slackWebhookHint: null,
|
|
1407
1424
|
enableGeofencing: false,
|
|
1408
1425
|
allowedCountries: [],
|
|
1409
1426
|
blockedCountries: [],
|
|
@@ -1414,8 +1431,10 @@ const SETTINGS_DEFAULTS = Object.freeze({
|
|
|
1414
1431
|
adminContentActivity: false,
|
|
1415
1432
|
securityLogStoreIp: true,
|
|
1416
1433
|
securityLogAnonymizeIp: false,
|
|
1434
|
+
securityLogGeoLookup: false,
|
|
1417
1435
|
securityLogRetentionDays: 90
|
|
1418
1436
|
});
|
|
1437
|
+
const WRITE_ONLY_SETTINGS_KEYS = Object.freeze(["discordWebhookUrl", "slackWebhookUrl"]);
|
|
1419
1438
|
const MAX_FAILED_LOGINS_RANGE = Object.freeze({ min: 0, max: 100 });
|
|
1420
1439
|
const WEBHOOK_HOSTS = Object.freeze({
|
|
1421
1440
|
discordWebhookUrl: ["discord.com", "discordapp.com"],
|
|
@@ -1525,7 +1544,7 @@ function validateSettings(settings) {
|
|
|
1525
1544
|
function getAdjustedFields(submitted, stored, previous) {
|
|
1526
1545
|
const source = submitted || {};
|
|
1527
1546
|
return Object.keys(source).filter(
|
|
1528
|
-
(key) => !areSettingsEqual(source[key], stored?.[key]) && (previous === void 0 || !areSettingsEqual(source[key], previous?.[key]))
|
|
1547
|
+
(key) => !WRITE_ONLY_SETTINGS_KEYS.includes(key) && !areSettingsEqual(source[key], stored?.[key]) && (previous === void 0 || !areSettingsEqual(source[key], previous?.[key]))
|
|
1529
1548
|
);
|
|
1530
1549
|
}
|
|
1531
1550
|
const COUNTRIES = [
|
|
@@ -1929,6 +1948,7 @@ const LoginProtectionTab = ({ form }) => {
|
|
|
1929
1948
|
const maxFailedError = tError(errors.maxFailedLogins);
|
|
1930
1949
|
const maxFailedValue = Number(settings.maxFailedLogins);
|
|
1931
1950
|
const lookupOff = !settings.enableGeolocation;
|
|
1951
|
+
const locked = form.canChangeProtected === false;
|
|
1932
1952
|
const risk = riskData.getRiskAvailability(form.geoIp.status);
|
|
1933
1953
|
const reject = riskData.riskDependentControl(settings.blockSuspiciousSessions, risk.state);
|
|
1934
1954
|
const autoStillRejects = reject.savedOnButInactive && (settings.geoLookupFailureMode || "auto") === "auto";
|
|
@@ -2081,7 +2101,7 @@ const LoginProtectionTab = ({ form }) => {
|
|
|
2081
2101
|
designSystem.SingleSelect,
|
|
2082
2102
|
{
|
|
2083
2103
|
value: settings.geoLookupFailureMode || "auto",
|
|
2084
|
-
disabled: lookupOff,
|
|
2104
|
+
disabled: lookupOff || locked,
|
|
2085
2105
|
onChange: (value) => handleChange("geoLookupFailureMode", value),
|
|
2086
2106
|
children: [
|
|
2087
2107
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "auto", children: t("settings.config.suspicious.failureMode.auto", "Automatic") }),
|
|
@@ -2189,6 +2209,7 @@ const GeoIpDatabaseCard = ({ form }) => {
|
|
|
2189
2209
|
);
|
|
2190
2210
|
};
|
|
2191
2211
|
const lookupOff = !settings.enableGeolocation;
|
|
2212
|
+
const locked = form.canChangeProtected === false;
|
|
2192
2213
|
const localDatabase = usesLocalDatabase(settings.geoIpProvider);
|
|
2193
2214
|
const databaseDisabled = lookupOff || !localDatabase;
|
|
2194
2215
|
const credentialSource = geoIpStatus?.credentialSource;
|
|
@@ -2226,7 +2247,7 @@ const GeoIpDatabaseCard = ({ form }) => {
|
|
|
2226
2247
|
designSystem.SingleSelect,
|
|
2227
2248
|
{
|
|
2228
2249
|
value: settings.geoIpProvider || "auto",
|
|
2229
|
-
disabled: lookupOff,
|
|
2250
|
+
disabled: lookupOff || locked,
|
|
2230
2251
|
onChange: (value) => handleChange("geoIpProvider", value),
|
|
2231
2252
|
children: [
|
|
2232
2253
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "auto", children: t("settings.config.provider.auto", "Automatic") }),
|
|
@@ -2422,7 +2443,7 @@ const GeoIpDatabaseCard = ({ form }) => {
|
|
|
2422
2443
|
{
|
|
2423
2444
|
name: "geoIpDatabasePath",
|
|
2424
2445
|
value: settings.geoIpDatabasePath || "",
|
|
2425
|
-
disabled: databaseDisabled && !errors.geoIpDatabasePath,
|
|
2446
|
+
disabled: (databaseDisabled || locked) && !errors.geoIpDatabasePath,
|
|
2426
2447
|
onChange: (event) => handleChange("geoIpDatabasePath", event.target.value),
|
|
2427
2448
|
placeholder: "GeoLite2-City.mmdb",
|
|
2428
2449
|
autoComplete: "off",
|
|
@@ -2578,6 +2599,7 @@ const LocationDataTab = ({ form }) => {
|
|
|
2578
2599
|
const { settings, handleChange } = form;
|
|
2579
2600
|
const risk = riskData.getRiskAvailability(form.geoIp.status);
|
|
2580
2601
|
const scoring = riskData.riskDependentControl(settings.enableSecurityScoring, risk.state);
|
|
2602
|
+
const locked = form.canChangeProtected === false;
|
|
2581
2603
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
2582
2604
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
|
2583
2605
|
/* @__PURE__ */ jsxRuntime.jsx(IntroText, { children: t(
|
|
@@ -2590,7 +2612,7 @@ const LocationDataTab = ({ form }) => {
|
|
|
2590
2612
|
) })
|
|
2591
2613
|
] }),
|
|
2592
2614
|
/* @__PURE__ */ jsxRuntime.jsxs(SectionCard.SectionCard, { title: t("settings.config.lookup.title", "IP location lookup"), children: [
|
|
2593
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2615
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2594
2616
|
SettingsToggleRow,
|
|
2595
2617
|
{
|
|
2596
2618
|
id: "enable-ip-geolocation",
|
|
@@ -2600,11 +2622,15 @@ const LocationDataTab = ({ form }) => {
|
|
|
2600
2622
|
"Looks up country and city at every sign-in and for listed sessions without a location."
|
|
2601
2623
|
),
|
|
2602
2624
|
checked: settings.enableGeolocation,
|
|
2625
|
+
disabled: locked,
|
|
2603
2626
|
onChange: (checked) => handleChange("enableGeolocation", checked),
|
|
2604
|
-
children:
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2627
|
+
children: [
|
|
2628
|
+
locked ? /* @__PURE__ */ jsxRuntime.jsx(ProtectedNotice, {}) : null,
|
|
2629
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.ReadableText, { variant: "pi", textColor: "neutral700", tag: "p", "data-privacy-note": "", children: t(
|
|
2630
|
+
"settings.config.lookup.enable.privacy",
|
|
2631
|
+
"With the Automatic or ipapi.co provider, IP addresses can be sent to ipapi.co."
|
|
2632
|
+
) })
|
|
2633
|
+
]
|
|
2608
2634
|
}
|
|
2609
2635
|
),
|
|
2610
2636
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2973,6 +2999,84 @@ const EmailTemplatesCard = ({ form }) => {
|
|
|
2973
2999
|
] })
|
|
2974
3000
|
] });
|
|
2975
3001
|
};
|
|
3002
|
+
const WebhookUrlField = ({
|
|
3003
|
+
form,
|
|
3004
|
+
id,
|
|
3005
|
+
field,
|
|
3006
|
+
hasKey,
|
|
3007
|
+
hintKey,
|
|
3008
|
+
label,
|
|
3009
|
+
description,
|
|
3010
|
+
placeholder,
|
|
3011
|
+
error,
|
|
3012
|
+
disabled = false
|
|
3013
|
+
}) => {
|
|
3014
|
+
const { t } = useSettingsTranslate();
|
|
3015
|
+
const { settings, handleChange } = form;
|
|
3016
|
+
const stored = settings[hasKey] === true;
|
|
3017
|
+
const draft = settings[field];
|
|
3018
|
+
const [replacing, setReplacing] = react.useState(false);
|
|
3019
|
+
const removing = stored && draft === "";
|
|
3020
|
+
const showInput = !stored || replacing || typeof draft === "string" && draft !== "";
|
|
3021
|
+
const onInput = (value) => handleChange(field, value ? value : void 0);
|
|
3022
|
+
const cancel = () => {
|
|
3023
|
+
handleChange(field, void 0);
|
|
3024
|
+
setReplacing(false);
|
|
3025
|
+
};
|
|
3026
|
+
if (!showInput) {
|
|
3027
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FormField, { id, name: field, label, description, error, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, "data-webhook-saved": field, children: [
|
|
3028
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, wrap: "wrap", alignItems: "center", minWidth: 0, children: [
|
|
3029
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3030
|
+
designSystem.Badge,
|
|
3031
|
+
{
|
|
3032
|
+
backgroundColor: removing ? "danger100" : "success100",
|
|
3033
|
+
textColor: removing ? "danger700" : "success700",
|
|
3034
|
+
children: removing ? t("settings.webhooks.removing", "Removed on save") : t("settings.webhooks.saved", "Saved")
|
|
3035
|
+
}
|
|
3036
|
+
),
|
|
3037
|
+
settings[hintKey] ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: settings[hintKey] }) : null
|
|
3038
|
+
] }),
|
|
3039
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, wrap: "wrap", children: removing ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", size: "S", disabled, onClick: cancel, children: t("settings.webhooks.undo", "Keep URL") }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3040
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3041
|
+
designSystem.Button,
|
|
3042
|
+
{
|
|
3043
|
+
variant: "secondary",
|
|
3044
|
+
size: "S",
|
|
3045
|
+
disabled,
|
|
3046
|
+
onClick: () => setReplacing(true),
|
|
3047
|
+
children: t("settings.webhooks.replace", "Replace")
|
|
3048
|
+
}
|
|
3049
|
+
),
|
|
3050
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3051
|
+
designSystem.Button,
|
|
3052
|
+
{
|
|
3053
|
+
variant: "danger-light",
|
|
3054
|
+
size: "S",
|
|
3055
|
+
disabled,
|
|
3056
|
+
onClick: () => handleChange(field, ""),
|
|
3057
|
+
children: t("settings.webhooks.remove", "Remove")
|
|
3058
|
+
}
|
|
3059
|
+
)
|
|
3060
|
+
] }) })
|
|
3061
|
+
] }) });
|
|
3062
|
+
}
|
|
3063
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FormField, { id, name: field, label, description, error, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
|
3064
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3065
|
+
SecretTextInput,
|
|
3066
|
+
{
|
|
3067
|
+
name: field,
|
|
3068
|
+
revealedType: "url",
|
|
3069
|
+
value: typeof draft === "string" ? draft : "",
|
|
3070
|
+
disabled: disabled && !error,
|
|
3071
|
+
onChange: onInput,
|
|
3072
|
+
placeholder,
|
|
3073
|
+
showLabel: t("settings.webhooks.show", "Show URL"),
|
|
3074
|
+
hideLabel: t("settings.webhooks.hide", "Hide URL")
|
|
3075
|
+
}
|
|
3076
|
+
),
|
|
3077
|
+
stored ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, wrap: "wrap", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", size: "S", onClick: cancel, children: t("settings.webhooks.cancelReplace", "Keep the saved URL") }) }) : null
|
|
3078
|
+
] }) });
|
|
3079
|
+
};
|
|
2976
3080
|
const WEBHOOK_EVENTS = Object.freeze({
|
|
2977
3081
|
suspicious: "login.suspicious",
|
|
2978
3082
|
newLocation: "login.new_location",
|
|
@@ -3012,6 +3116,7 @@ const AlertsTab = ({ form }) => {
|
|
|
3012
3116
|
const lookupOff = !settings.enableGeolocation;
|
|
3013
3117
|
const emailTypesDisabled = lookupOff || !settings.enableEmailAlerts;
|
|
3014
3118
|
const webhookFieldsDisabled = lookupOff || !settings.enableWebhooks;
|
|
3119
|
+
const locked = form.canChangeProtected === false;
|
|
3015
3120
|
const templateErrors = fieldHasError(errors, "emailTemplates");
|
|
3016
3121
|
const risk = riskData.getRiskAvailability(form.geoIp.status);
|
|
3017
3122
|
const emailTypes = [
|
|
@@ -3137,7 +3242,7 @@ const AlertsTab = ({ form }) => {
|
|
|
3137
3242
|
WEBHOOK_EVENTS
|
|
3138
3243
|
),
|
|
3139
3244
|
checked: settings.enableWebhooks,
|
|
3140
|
-
disabled: lookupOff,
|
|
3245
|
+
disabled: lookupOff || locked,
|
|
3141
3246
|
onChange: (checked) => handleChange("enableWebhooks", checked)
|
|
3142
3247
|
}
|
|
3143
3248
|
),
|
|
@@ -3147,64 +3252,51 @@ const AlertsTab = ({ form }) => {
|
|
|
3147
3252
|
"Without a risk data source, {suspicious} is never sent.",
|
|
3148
3253
|
WEBHOOK_EVENTS
|
|
3149
3254
|
) }) : null,
|
|
3255
|
+
locked ? /* @__PURE__ */ jsxRuntime.jsx(ProtectedNotice, {}) : null,
|
|
3150
3256
|
/* @__PURE__ */ jsxRuntime.jsxs(index.EqualGrid, { columns: 2, stackBelow: "medium", gap: 6, children: [
|
|
3151
3257
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3152
|
-
|
|
3258
|
+
WebhookUrlField,
|
|
3153
3259
|
{
|
|
3260
|
+
form,
|
|
3154
3261
|
id: "discord-webhook-url",
|
|
3155
|
-
|
|
3262
|
+
field: "discordWebhookUrl",
|
|
3263
|
+
hasKey: "hasDiscordWebhook",
|
|
3264
|
+
hintKey: "discordWebhookHint",
|
|
3156
3265
|
label: t("settings.config.webhooks.discord.label", "Discord webhook URL"),
|
|
3157
3266
|
description: t(
|
|
3158
3267
|
"settings.config.webhooks.discord.hint",
|
|
3159
3268
|
"Must start with https://discord.com or https://discordapp.com. Anyone with this URL can post to your channel."
|
|
3160
3269
|
),
|
|
3161
3270
|
error: tError(errors.discordWebhookUrl),
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
revealedType: "url",
|
|
3167
|
-
value: settings.discordWebhookUrl || "",
|
|
3168
|
-
disabled: webhookFieldsDisabled && !errors.discordWebhookUrl,
|
|
3169
|
-
onChange: (value) => handleChange("discordWebhookUrl", value),
|
|
3170
|
-
placeholder: t(
|
|
3171
|
-
"settings.webhooks.discord.placeholder",
|
|
3172
|
-
"https://discord.com/api/webhooks/123456789/abcdefghijklmnopqrstuvwxyz..."
|
|
3173
|
-
),
|
|
3174
|
-
showLabel: t("settings.webhooks.show", "Show URL"),
|
|
3175
|
-
hideLabel: t("settings.webhooks.hide", "Hide URL")
|
|
3176
|
-
}
|
|
3271
|
+
disabled: webhookFieldsDisabled || locked,
|
|
3272
|
+
placeholder: t(
|
|
3273
|
+
"settings.webhooks.discord.placeholder",
|
|
3274
|
+
"https://discord.com/api/webhooks/123456789/abcdefghijklmnopqrstuvwxyz..."
|
|
3177
3275
|
)
|
|
3178
|
-
}
|
|
3276
|
+
},
|
|
3277
|
+
`discord-${form.draftVersion}`
|
|
3179
3278
|
),
|
|
3180
3279
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3181
|
-
|
|
3280
|
+
WebhookUrlField,
|
|
3182
3281
|
{
|
|
3282
|
+
form,
|
|
3183
3283
|
id: "slack-webhook-url",
|
|
3184
|
-
|
|
3284
|
+
field: "slackWebhookUrl",
|
|
3285
|
+
hasKey: "hasSlackWebhook",
|
|
3286
|
+
hintKey: "slackWebhookHint",
|
|
3185
3287
|
label: t("settings.config.webhooks.slack.label", "Slack webhook URL"),
|
|
3186
3288
|
description: t(
|
|
3187
3289
|
"settings.config.webhooks.slack.hint",
|
|
3188
3290
|
"Must start with https://hooks.slack.com. Anyone with this URL can post to your channel."
|
|
3189
3291
|
),
|
|
3190
3292
|
error: tError(errors.slackWebhookUrl),
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
revealedType: "url",
|
|
3196
|
-
value: settings.slackWebhookUrl || "",
|
|
3197
|
-
disabled: webhookFieldsDisabled && !errors.slackWebhookUrl,
|
|
3198
|
-
onChange: (value) => handleChange("slackWebhookUrl", value),
|
|
3199
|
-
placeholder: t(
|
|
3200
|
-
"settings.webhooks.slack.placeholder",
|
|
3201
|
-
"https://hooks.slack.com/services/XXXX/XXXX/XXXX"
|
|
3202
|
-
),
|
|
3203
|
-
showLabel: t("settings.webhooks.show", "Show URL"),
|
|
3204
|
-
hideLabel: t("settings.webhooks.hide", "Hide URL")
|
|
3205
|
-
}
|
|
3293
|
+
disabled: webhookFieldsDisabled || locked,
|
|
3294
|
+
placeholder: t(
|
|
3295
|
+
"settings.webhooks.slack.placeholder",
|
|
3296
|
+
"https://hooks.slack.com/services/XXXX/XXXX/XXXX"
|
|
3206
3297
|
)
|
|
3207
|
-
}
|
|
3298
|
+
},
|
|
3299
|
+
`slack-${form.draftVersion}`
|
|
3208
3300
|
)
|
|
3209
3301
|
] })
|
|
3210
3302
|
]
|
|
@@ -3290,11 +3382,13 @@ const AdminActivityTab = ({ form }) => {
|
|
|
3290
3382
|
const { t } = useSettingsTranslate();
|
|
3291
3383
|
const units = useOptionLabels();
|
|
3292
3384
|
const { settings, handleChange } = form;
|
|
3385
|
+
const locked = form.canChangeProtected === false;
|
|
3293
3386
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
3294
3387
|
/* @__PURE__ */ jsxRuntime.jsx(IntroText, { children: t(
|
|
3295
3388
|
"settings.config.adminActivity.intro",
|
|
3296
3389
|
"The security log records sign-ins and work in this admin panel. Each admin’s history is under Session Manager > Admin panel; only admins with “View admin activity” can open it."
|
|
3297
3390
|
) }),
|
|
3391
|
+
locked ? /* @__PURE__ */ jsxRuntime.jsx(ProtectedNotice, {}) : null,
|
|
3298
3392
|
/* @__PURE__ */ jsxRuntime.jsxs(SectionCard.SectionCard, { title: t("settings.config.adminActivity.recording.title", "What is recorded"), children: [
|
|
3299
3393
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3300
3394
|
SettingsToggleRow,
|
|
@@ -3306,6 +3400,7 @@ const AdminActivityTab = ({ form }) => {
|
|
|
3306
3400
|
"Every sign-in, failed attempt, lockout and sign-out, and who signed out whom, with time, browser and operating system."
|
|
3307
3401
|
),
|
|
3308
3402
|
checked: settings.adminSignInHistory,
|
|
3403
|
+
disabled: locked,
|
|
3309
3404
|
onChange: (checked) => handleChange("adminSignInHistory", checked)
|
|
3310
3405
|
}
|
|
3311
3406
|
),
|
|
@@ -3319,9 +3414,10 @@ const AdminActivityTab = ({ form }) => {
|
|
|
3319
3414
|
),
|
|
3320
3415
|
description: t(
|
|
3321
3416
|
"settings.config.adminActivity.content.hint",
|
|
3322
|
-
"Which entries each admin opens, creates, edits, publishes, unpublishes or deletes, with content type,
|
|
3417
|
+
"Which entries each admin opens, creates, edits, publishes, unpublishes or deletes, with content type, locale and time. Entry titles are not stored; the list shows them only to admins who may open the entry."
|
|
3323
3418
|
),
|
|
3324
3419
|
checked: settings.adminContentActivity,
|
|
3420
|
+
disabled: locked,
|
|
3325
3421
|
onChange: (checked) => handleChange("adminContentActivity", checked),
|
|
3326
3422
|
children: /* @__PURE__ */ jsxRuntime.jsx(index.ReadableText, { variant: "pi", textColor: "neutral700", tag: "p", "data-privacy-note": "", children: t(
|
|
3327
3423
|
"settings.config.adminActivity.content.notice",
|
|
@@ -3349,6 +3445,7 @@ const AdminActivityTab = ({ form }) => {
|
|
|
3349
3445
|
"The address comes from Strapi’s client IP (server.proxy settings). The location uses the IP location lookup under Location data."
|
|
3350
3446
|
),
|
|
3351
3447
|
checked: settings.securityLogStoreIp,
|
|
3448
|
+
disabled: locked,
|
|
3352
3449
|
onChange: (checked) => handleChange("securityLogStoreIp", checked)
|
|
3353
3450
|
}
|
|
3354
3451
|
),
|
|
@@ -3365,11 +3462,29 @@ const AdminActivityTab = ({ form }) => {
|
|
|
3365
3462
|
"Stores 203.0.113.0 instead of 203.0.113.42 (IPv6: the first 48 bits only)."
|
|
3366
3463
|
),
|
|
3367
3464
|
checked: settings.securityLogAnonymizeIp,
|
|
3368
|
-
disabled: !settings.securityLogStoreIp,
|
|
3465
|
+
disabled: locked || !settings.securityLogStoreIp,
|
|
3369
3466
|
onChange: (checked) => handleChange("securityLogAnonymizeIp", checked),
|
|
3370
3467
|
children: !settings.securityLogStoreIp ? /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { children: t("settings.config.adminActivity.requiresIp", "Requires Store IP addresses") }) : null
|
|
3371
3468
|
}
|
|
3372
3469
|
),
|
|
3470
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3471
|
+
SettingsToggleRow,
|
|
3472
|
+
{
|
|
3473
|
+
id: "security-log-geo-lookup",
|
|
3474
|
+
title: t(
|
|
3475
|
+
"settings.config.adminActivity.geoLookup.label",
|
|
3476
|
+
"Look up the location of security events"
|
|
3477
|
+
),
|
|
3478
|
+
description: t(
|
|
3479
|
+
"settings.config.adminActivity.geoLookup.hint",
|
|
3480
|
+
"Shows country and city next to each sign-in. Only the anonymised address is looked up, in the local GeoIP database; it goes to ipapi.co only if you chose ipapi.co as provider under Location data."
|
|
3481
|
+
),
|
|
3482
|
+
checked: settings.securityLogGeoLookup,
|
|
3483
|
+
disabled: locked || !settings.securityLogStoreIp,
|
|
3484
|
+
onChange: (checked) => handleChange("securityLogGeoLookup", checked),
|
|
3485
|
+
children: !settings.securityLogStoreIp ? /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { children: t("settings.config.adminActivity.requiresIp", "Requires Store IP addresses") }) : null
|
|
3486
|
+
}
|
|
3487
|
+
),
|
|
3373
3488
|
/* @__PURE__ */ jsxRuntime.jsx(index.EqualGrid, { columns: 2, stackBelow: "medium", gap: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3374
3489
|
PresetSelect,
|
|
3375
3490
|
{
|
|
@@ -3378,11 +3493,12 @@ const AdminActivityTab = ({ form }) => {
|
|
|
3378
3493
|
label: t("settings.config.adminActivity.retention.label", "Keep security events for"),
|
|
3379
3494
|
description: t(
|
|
3380
3495
|
"settings.config.adminActivity.retention.hint",
|
|
3381
|
-
"Older events are deleted once a day. Events of a deleted admin are deleted with the account."
|
|
3496
|
+
"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."
|
|
3382
3497
|
),
|
|
3383
3498
|
value: settings.securityLogRetentionDays,
|
|
3384
3499
|
presets: SELECT_PRESETS.securityLogRetentionDays,
|
|
3385
3500
|
format: units.days,
|
|
3501
|
+
disabled: locked,
|
|
3386
3502
|
onChange: (value) => handleChange("securityLogRetentionDays", value)
|
|
3387
3503
|
}
|
|
3388
3504
|
) })
|
|
@@ -3517,7 +3633,14 @@ function useSettingsForm() {
|
|
|
3517
3633
|
if (key === "strictSessionEnforcement") {
|
|
3518
3634
|
setRelaxedWarningDismissed(false);
|
|
3519
3635
|
}
|
|
3520
|
-
setSettings((previousSettings) =>
|
|
3636
|
+
setSettings((previousSettings) => {
|
|
3637
|
+
if (value === void 0) {
|
|
3638
|
+
const next = { ...previousSettings };
|
|
3639
|
+
delete next[key];
|
|
3640
|
+
return next;
|
|
3641
|
+
}
|
|
3642
|
+
return { ...previousSettings, [key]: value };
|
|
3643
|
+
});
|
|
3521
3644
|
}, []);
|
|
3522
3645
|
const handleSave = react.useCallback(async () => {
|
|
3523
3646
|
const submitted = buildSavePayload(settingsRef.current, savedSettingsRef.current);
|
|
@@ -3787,6 +3910,9 @@ const SettingsPage = () => {
|
|
|
3787
3910
|
const {
|
|
3788
3911
|
allowedActions: { canRead: canViewAdminActivity }
|
|
3789
3912
|
} = StrapiAdmin.useRBAC(index.pluginPermissions.adminActivityRead);
|
|
3913
|
+
const {
|
|
3914
|
+
allowedActions: { canUpdate: canChangeProtected }
|
|
3915
|
+
} = StrapiAdmin.useRBAC(index.pluginPermissions.settingsUpdate);
|
|
3790
3916
|
const visibleTabs = react.useMemo(
|
|
3791
3917
|
() => getVisibleSettingsTabs(Boolean(canViewAdminActivity)),
|
|
3792
3918
|
[canViewAdminActivity]
|
|
@@ -3915,7 +4041,12 @@ const SettingsPage = () => {
|
|
|
3915
4041
|
),
|
|
3916
4042
|
visibleTabs.map((tab) => {
|
|
3917
4043
|
const TabPanel = TAB_COMPONENTS[tab];
|
|
3918
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: tab, forceMount: true, hidden: activeTab !== tab, children: /* @__PURE__ */ jsxRuntime.jsx(TabPanelFrame, { "data-settings-tab-panel": "", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", paddingTop: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4044
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: tab, forceMount: true, hidden: activeTab !== tab, children: /* @__PURE__ */ jsxRuntime.jsx(TabPanelFrame, { "data-settings-tab-panel": "", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", paddingTop: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4045
|
+
TabPanel,
|
|
4046
|
+
{
|
|
4047
|
+
form: { ...form, canChangeProtected: Boolean(canChangeProtected) }
|
|
4048
|
+
}
|
|
4049
|
+
) }) }) }, tab);
|
|
3919
4050
|
}),
|
|
3920
4051
|
/* @__PURE__ */ jsxRuntime.jsxs(StrapiAdmin.Form, { method: "PUT", initialValues: form.savedSettings, children: [
|
|
3921
4052
|
/* @__PURE__ */ jsxRuntime.jsx(DraftSync, { values: form.settings }),
|