strapi-security-suite 0.1.0 → 0.1.2
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/dist/admin/index.js +8 -7
- package/dist/admin/index.mjs +8 -7
- package/package.json +1 -1
package/dist/admin/index.js
CHANGED
|
@@ -71,21 +71,22 @@ const index = {
|
|
|
71
71
|
};
|
|
72
72
|
if (!window.__fetchPatchedForSession) {
|
|
73
73
|
window.addEventListener("unhandledrejection", function(event) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
74
|
+
console.log(event.reason);
|
|
75
|
+
autologout();
|
|
77
76
|
});
|
|
78
77
|
window.addEventListener("error", function(event) {
|
|
79
78
|
const message = event.message || "";
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
79
|
+
console.log(message);
|
|
80
|
+
autologout();
|
|
83
81
|
});
|
|
84
82
|
const originalFetch = window.fetch;
|
|
85
83
|
window.fetch = async (...args) => {
|
|
86
84
|
try {
|
|
87
85
|
const response = await originalFetch(...args);
|
|
88
|
-
|
|
86
|
+
const except = await originalFetch(...args);
|
|
87
|
+
const exceptError = await except.json();
|
|
88
|
+
const { error } = exceptError ?? {};
|
|
89
|
+
if ([400, 440].includes(response.status) && !error?.message?.includes("Invalid credentials")) {
|
|
89
90
|
if (window.stop) window.stop();
|
|
90
91
|
if (document.execCommand) document.execCommand("Stop");
|
|
91
92
|
window.location.reload();
|
package/dist/admin/index.mjs
CHANGED
|
@@ -70,21 +70,22 @@ const index = {
|
|
|
70
70
|
};
|
|
71
71
|
if (!window.__fetchPatchedForSession) {
|
|
72
72
|
window.addEventListener("unhandledrejection", function(event) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
73
|
+
console.log(event.reason);
|
|
74
|
+
autologout();
|
|
76
75
|
});
|
|
77
76
|
window.addEventListener("error", function(event) {
|
|
78
77
|
const message = event.message || "";
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
78
|
+
console.log(message);
|
|
79
|
+
autologout();
|
|
82
80
|
});
|
|
83
81
|
const originalFetch = window.fetch;
|
|
84
82
|
window.fetch = async (...args) => {
|
|
85
83
|
try {
|
|
86
84
|
const response = await originalFetch(...args);
|
|
87
|
-
|
|
85
|
+
const except = await originalFetch(...args);
|
|
86
|
+
const exceptError = await except.json();
|
|
87
|
+
const { error } = exceptError ?? {};
|
|
88
|
+
if ([400, 440].includes(response.status) && !error?.message?.includes("Invalid credentials")) {
|
|
88
89
|
if (window.stop) window.stop();
|
|
89
90
|
if (document.execCommand) document.execCommand("Stop");
|
|
90
91
|
window.location.reload();
|
package/package.json
CHANGED