chore: login/signup improvements
This commit is contained in:
@@ -34,3 +34,5 @@ yarn-error.log*
|
|||||||
|
|
||||||
# vercel
|
# vercel
|
||||||
.vercel
|
.vercel
|
||||||
|
|
||||||
|
vite.config.ts*.mjs
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { dev } from '$app/environment';
|
||||||
import { redirect } from '@sveltejs/kit';
|
import { redirect } from '@sveltejs/kit';
|
||||||
import { blockedSubdomain } from '$lib/utils/constants/app';
|
import { blockedSubdomain } from '$lib/utils/constants/app';
|
||||||
import { getCurrentOrg } from '$lib/utils/services/org';
|
import { getCurrentOrg } from '$lib/utils/services/org';
|
||||||
@@ -37,12 +38,12 @@ export const load = async ({ url, cookies }): Promise<LoadOutput> => {
|
|||||||
response.orgSiteName = debugMode ? _orgSiteName : subdomain;
|
response.orgSiteName = debugMode ? _orgSiteName : subdomain;
|
||||||
response.org = (await getCurrentOrg(response.orgSiteName, true)) || null;
|
response.org = (await getCurrentOrg(response.orgSiteName, true)) || null;
|
||||||
|
|
||||||
if (!response.org) {
|
if (!response.org && !dev) {
|
||||||
throw redirect(301, 'https://app.classroomio.com/404?type=org');
|
throw redirect(301, 'https://app.classroomio.com/404?type=org');
|
||||||
}
|
}
|
||||||
} else if (subdomain === 'play' || debugPlay === 'true') {
|
} else if (subdomain === 'play' || debugPlay === 'true') {
|
||||||
response.skipAuth = true;
|
response.skipAuth = true;
|
||||||
} else if (subdomain !== 'app') {
|
} else if (subdomain !== 'app' && !dev) {
|
||||||
throw redirect(301, 'https://app.classroomio.com');
|
throw redirect(301, 'https://app.classroomio.com');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import { fly } from 'svelte/transition';
|
import { fly } from 'svelte/transition';
|
||||||
import { derived } from 'svelte/store';
|
import { derived } from 'svelte/store';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { browser } from '$app/environment';
|
import { browser, dev } from '$app/environment';
|
||||||
import { page, navigating } from '$app/stores';
|
import { page, navigating } from '$app/stores';
|
||||||
import isEmpty from 'lodash/isEmpty';
|
import isEmpty from 'lodash/isEmpty';
|
||||||
import { Theme, ToastNotification, Loading } from 'carbon-components-svelte';
|
import { Theme, ToastNotification, Loading } from 'carbon-components-svelte';
|
||||||
@@ -56,6 +56,10 @@
|
|||||||
|
|
||||||
// Set up posthog
|
// Set up posthog
|
||||||
initPosthog();
|
initPosthog();
|
||||||
|
|
||||||
|
if (!dev) {
|
||||||
|
injectSpeedInsights();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setAnalyticsUser() {
|
function setAnalyticsUser() {
|
||||||
@@ -216,8 +220,6 @@
|
|||||||
|
|
||||||
setupAnalytics();
|
setupAnalytics();
|
||||||
|
|
||||||
injectSpeedInsights();
|
|
||||||
|
|
||||||
handleResize();
|
handleResize();
|
||||||
|
|
||||||
if (!isSupabaseTokenInLocalStorage() && !isPublicRoute($page.url?.pathname)) {
|
if (!isSupabaseTokenInLocalStorage() && !isPublicRoute($page.url?.pathname)) {
|
||||||
|
|||||||
@@ -42,7 +42,6 @@
|
|||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
submitError = error.error_description || error.message;
|
submitError = error.error_description || error.message;
|
||||||
} finally {
|
|
||||||
loading = false;
|
loading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,6 @@
|
|||||||
fields = Object.assign({}, SIGNUP_FIELDS);
|
fields = Object.assign({}, SIGNUP_FIELDS);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
submitError = error?.error_description || error?.message;
|
submitError = error?.error_description || error?.message;
|
||||||
} finally {
|
|
||||||
loading = false;
|
loading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user