Add missing theme functions for metamigo-frontend

This commit is contained in:
Darren Clarke 2023-05-26 08:06:16 +00:00
parent 3ca903cf4f
commit 8fabcbaba2
4 changed files with 56 additions and 22 deletions

View file

@ -1,4 +1,5 @@
import { withAuth } from "next-auth/middleware";
import getConfig from "next/config";
export default withAuth(
() => { },
@ -13,26 +14,32 @@ export default withAuth(
headers,
} = req;
const embedded = process.env.LINK_EMBEDDED === "true";
if (embedded) {
return true;
}
// check login page
const parsedURL = new URL(url);
if (parsedURL.pathname.startsWith('/login')) {
return true;
}
// check session auth
const authorizedDomains = ["redaranj.com", "digiresilience.org"];
const userDomain = token?.email?.toLowerCase().split("@").pop() ?? "unauthorized.net";
if (authorizedDomains.includes(userDomain)) {
return true;
}
return false;
return true;
/*
const {
publicRuntimeConfig: { embedded },
} = getConfig();
if (embedded) {
return true;
}
// check login page
const parsedURL = new URL(url);
if (parsedURL.pathname.startsWith('/login')) {
return true;
}
// check session auth
const authorizedDomains = ["redaranj.com", "digiresilience.org"];
const userDomain = token?.email?.toLowerCase().split("@").pop() ?? "unauthorized.net";
if (authorizedDomains.includes(userDomain)) {
return true;
}
return false;
*/
},
}
}