strapi-custom-auth 1.2.5 → 1.2.7
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 +16 -14
- package/dist/admin/index.mjs +16 -14
- package/dist/server/index.js +14 -1
- package/dist/server/index.mjs +14 -1
- package/package.json +1 -1
package/dist/admin/index.js
CHANGED
|
@@ -69,7 +69,7 @@ const originalFetch = window.fetch;
|
|
|
69
69
|
const fetchInterceptor = (storage) => {
|
|
70
70
|
window.fetch = async (input, init = {}) => {
|
|
71
71
|
const url = input instanceof Request ? input.url : input;
|
|
72
|
-
if (url.includes("/admin/renew-token") || url.includes("/auth/login") || url.includes("repos/strapi/strapi/releases/latest")) {
|
|
72
|
+
if (url.includes("/admin/renew-token") || url.includes("/auth/login") || url.includes("repos/strapi/strapi/releases/latest") || url.includes("/admin/init")) {
|
|
73
73
|
return originalFetch(input, init);
|
|
74
74
|
}
|
|
75
75
|
let token = storage.getItem("jwtToken").replace(/"/g, "");
|
|
@@ -160,20 +160,22 @@ const index = {
|
|
|
160
160
|
}))
|
|
161
161
|
}
|
|
162
162
|
});
|
|
163
|
-
app.addMenuLink({
|
|
164
|
-
to: "/custom-logout",
|
|
165
|
-
icon: icons.SignOut,
|
|
166
|
-
intlLabel: {
|
|
167
|
-
id: "custom-logout.label",
|
|
168
|
-
defaultMessage: "Logout"
|
|
169
|
-
},
|
|
170
|
-
Component: async () => {
|
|
171
|
-
const component = await Promise.resolve().then(() => require("../_chunks/CustomLogoutPage-CuntyG5p.js"));
|
|
172
|
-
return component.default;
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
163
|
const storage = localStorage.getItem("jwtToken") ? localStorage : sessionStorage;
|
|
176
|
-
|
|
164
|
+
if (["microsoft"].includes(storage.getItem("provider"))) {
|
|
165
|
+
app.addMenuLink({
|
|
166
|
+
to: "/custom-logout",
|
|
167
|
+
icon: icons.SignOut,
|
|
168
|
+
intlLabel: {
|
|
169
|
+
id: "custom-logout.label",
|
|
170
|
+
defaultMessage: "Logout"
|
|
171
|
+
},
|
|
172
|
+
Component: async () => {
|
|
173
|
+
const component = await Promise.resolve().then(() => require("../_chunks/CustomLogoutPage-CuntyG5p.js"));
|
|
174
|
+
return component.default;
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
fetchInterceptor(storage);
|
|
178
|
+
}
|
|
177
179
|
},
|
|
178
180
|
async registerTrads({ locales }) {
|
|
179
181
|
return Promise.all(
|
package/dist/admin/index.mjs
CHANGED
|
@@ -68,7 +68,7 @@ const originalFetch = window.fetch;
|
|
|
68
68
|
const fetchInterceptor = (storage) => {
|
|
69
69
|
window.fetch = async (input, init = {}) => {
|
|
70
70
|
const url = input instanceof Request ? input.url : input;
|
|
71
|
-
if (url.includes("/admin/renew-token") || url.includes("/auth/login") || url.includes("repos/strapi/strapi/releases/latest")) {
|
|
71
|
+
if (url.includes("/admin/renew-token") || url.includes("/auth/login") || url.includes("repos/strapi/strapi/releases/latest") || url.includes("/admin/init")) {
|
|
72
72
|
return originalFetch(input, init);
|
|
73
73
|
}
|
|
74
74
|
let token = storage.getItem("jwtToken").replace(/"/g, "");
|
|
@@ -159,20 +159,22 @@ const index = {
|
|
|
159
159
|
}))
|
|
160
160
|
}
|
|
161
161
|
});
|
|
162
|
-
app.addMenuLink({
|
|
163
|
-
to: "/custom-logout",
|
|
164
|
-
icon: SignOut,
|
|
165
|
-
intlLabel: {
|
|
166
|
-
id: "custom-logout.label",
|
|
167
|
-
defaultMessage: "Logout"
|
|
168
|
-
},
|
|
169
|
-
Component: async () => {
|
|
170
|
-
const component = await import("../_chunks/CustomLogoutPage-Be-GcZA3.mjs");
|
|
171
|
-
return component.default;
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
162
|
const storage = localStorage.getItem("jwtToken") ? localStorage : sessionStorage;
|
|
175
|
-
|
|
163
|
+
if (["microsoft"].includes(storage.getItem("provider"))) {
|
|
164
|
+
app.addMenuLink({
|
|
165
|
+
to: "/custom-logout",
|
|
166
|
+
icon: SignOut,
|
|
167
|
+
intlLabel: {
|
|
168
|
+
id: "custom-logout.label",
|
|
169
|
+
defaultMessage: "Logout"
|
|
170
|
+
},
|
|
171
|
+
Component: async () => {
|
|
172
|
+
const component = await import("../_chunks/CustomLogoutPage-Be-GcZA3.mjs");
|
|
173
|
+
return component.default;
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
fetchInterceptor(storage);
|
|
177
|
+
}
|
|
176
178
|
},
|
|
177
179
|
async registerTrads({ locales }) {
|
|
178
180
|
return Promise.all(
|
package/dist/server/index.js
CHANGED
|
@@ -3084,7 +3084,7 @@ const configValidation$1 = () => {
|
|
|
3084
3084
|
if (config2["SMTP_HOST"] && config2["SMTP_PORT"] && config2["SMTP_USER"] && config2["MAIL_FROM"] && config2["SMTP_PASSWORD"]) {
|
|
3085
3085
|
return config2;
|
|
3086
3086
|
}
|
|
3087
|
-
|
|
3087
|
+
console.warn("SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASSWORD, MAIL_FROM are required");
|
|
3088
3088
|
};
|
|
3089
3089
|
async function customSignIn(ctx) {
|
|
3090
3090
|
const oauthService = strapi.plugin("strapi-custom-auth").service("oauth");
|
|
@@ -39406,6 +39406,19 @@ var role = ({ strapi: strapi2 }) => ({
|
|
|
39406
39406
|
});
|
|
39407
39407
|
})
|
|
39408
39408
|
);
|
|
39409
|
+
},
|
|
39410
|
+
async retrieveMicrosoftUserRole(groupList, config2) {
|
|
39411
|
+
const allowedGroups = /* @__PURE__ */ new Set([
|
|
39412
|
+
String(config2["ENTRA_ADMIN_GROUP_NAME"]),
|
|
39413
|
+
String(config2["ENTRA_EDITOR_GROUP_NAME"])
|
|
39414
|
+
]);
|
|
39415
|
+
const filteredGroups = groupList.filter((group) => allowedGroups.has(group.displayName));
|
|
39416
|
+
const dbRoles = await strapi2.db.query("admin::role").findMany();
|
|
39417
|
+
const roles2 = filteredGroups.map((group) => {
|
|
39418
|
+
const roleName = group.displayName.includes("Admin") ? "admin" : "editor";
|
|
39419
|
+
return dbRoles.find((role2) => role2.name.toLowerCase().includes(roleName))?.id;
|
|
39420
|
+
}).filter(Boolean);
|
|
39421
|
+
return roles2;
|
|
39409
39422
|
}
|
|
39410
39423
|
});
|
|
39411
39424
|
const role$1 = /* @__PURE__ */ getDefaultExportFromCjs(role);
|
package/dist/server/index.mjs
CHANGED
|
@@ -3069,7 +3069,7 @@ const configValidation$1 = () => {
|
|
|
3069
3069
|
if (config2["SMTP_HOST"] && config2["SMTP_PORT"] && config2["SMTP_USER"] && config2["MAIL_FROM"] && config2["SMTP_PASSWORD"]) {
|
|
3070
3070
|
return config2;
|
|
3071
3071
|
}
|
|
3072
|
-
|
|
3072
|
+
console.warn("SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASSWORD, MAIL_FROM are required");
|
|
3073
3073
|
};
|
|
3074
3074
|
async function customSignIn(ctx) {
|
|
3075
3075
|
const oauthService = strapi.plugin("strapi-custom-auth").service("oauth");
|
|
@@ -39391,6 +39391,19 @@ var role = ({ strapi: strapi2 }) => ({
|
|
|
39391
39391
|
});
|
|
39392
39392
|
})
|
|
39393
39393
|
);
|
|
39394
|
+
},
|
|
39395
|
+
async retrieveMicrosoftUserRole(groupList, config2) {
|
|
39396
|
+
const allowedGroups = /* @__PURE__ */ new Set([
|
|
39397
|
+
String(config2["ENTRA_ADMIN_GROUP_NAME"]),
|
|
39398
|
+
String(config2["ENTRA_EDITOR_GROUP_NAME"])
|
|
39399
|
+
]);
|
|
39400
|
+
const filteredGroups = groupList.filter((group) => allowedGroups.has(group.displayName));
|
|
39401
|
+
const dbRoles = await strapi2.db.query("admin::role").findMany();
|
|
39402
|
+
const roles2 = filteredGroups.map((group) => {
|
|
39403
|
+
const roleName = group.displayName.includes("Admin") ? "admin" : "editor";
|
|
39404
|
+
return dbRoles.find((role2) => role2.name.toLowerCase().includes(roleName))?.id;
|
|
39405
|
+
}).filter(Boolean);
|
|
39406
|
+
return roles2;
|
|
39394
39407
|
}
|
|
39395
39408
|
});
|
|
39396
39409
|
const role$1 = /* @__PURE__ */ getDefaultExportFromCjs(role);
|
package/package.json
CHANGED