feat: implement forward domain for gauth
This commit is contained in:
@@ -23,7 +23,9 @@
|
|||||||
|
|
||||||
const params = new URLSearchParams(window.location.search);
|
const params = new URLSearchParams(window.location.search);
|
||||||
console.log({ params });
|
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 });
|
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 matches = url.host.match(/([a-z 0-9 -]+).*classroomio[.]com/);
|
||||||
const subdomain = matches?.[1] ?? '';
|
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)) {
|
if (!blockedSubdomain.includes(subdomain)) {
|
||||||
const answer = Array.isArray(matches) ? !!subdomain && subdomain !== 'www' : false;
|
const answer = Array.isArray(matches) ? !!subdomain && subdomain !== 'www' : false;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user