feat: implement forward domain for gauth

This commit is contained in:
Rotimi Best
2023-12-14 12:07:27 +03:00
parent 126bdb4cc8
commit b420105ddf
2 changed files with 12 additions and 1 deletions
@@ -23,7 +23,9 @@
const params = new URLSearchParams(window.location.search);
console.log({ params });
const redirectTo = window.location.origin + params.get('redirectTo');
const redirectTo = `https://app.classroomio.com?forwardTo=${
window.location.origin + params.get('redirect')
}`;
console.log({ redirectTo });
@@ -31,6 +31,15 @@ export const load = async ({ url, cookies }): Promise<LoadOutput> => {
const matches = url.host.match(/([a-z 0-9 -]+).*classroomio[.]com/);
const subdomain = matches?.[1] ?? '';
if (subdomain === 'app' && url.search && url.search?.includes('forwardTo')) {
const params = new URLSearchParams(url.search);
const forwardToURL = params.get('forwardTo');
if (forwardToURL) {
throw redirect(307, forwardToURL);
}
}
if (!blockedSubdomain.includes(subdomain)) {
const answer = Array.isArray(matches) ? !!subdomain && subdomain !== 'www' : false;