diff --git a/src/hooks.server.ts b/src/hooks.server.ts index 8954dfa..2eb3d5d 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -67,10 +67,12 @@ const authGuard: Handle = async ({ event, resolve }) => { event.locals.session = session; event.locals.user = user; + console.log(event.locals); + // Protect routes that require authentication if (event.url.pathname.startsWith('/app')) { if (!session) { - throw redirect(303, '/auth/login'); + throw redirect(303, '/auth'); } } diff --git a/src/routes/auth/+page.svelte b/src/routes/auth/+page.svelte index ad5a25e..da0aee0 100644 --- a/src/routes/auth/+page.svelte +++ b/src/routes/auth/+page.svelte @@ -2,7 +2,7 @@ import { supabase } from '$lib/supabaseClient'; import { goto } from '$app/navigation'; import { toaster } from '$lib'; - import { Mail, Lock, LogIn, UserPlus, Github, Chrome, MessageCircle, Twitter, Star, Eye, EyeOff } from '@lucide/svelte'; + import { Mail, Lock, LogIn, UserPlus, Github, Chrome, MessageCircle, Twitter, Star, Eye, EyeOff, AlertTriangle } from '@lucide/svelte'; import { onMount } from 'svelte'; let activeTab = $state('login'); // 'login' or 'signup' @@ -26,40 +26,55 @@ let oauthLoading = $state(''); let message = $state(''); - // OAuth providers configuration + // OAuth providers configuration - only GitHub enabled for demo const oauthProviders = [ { name: 'GitHub', provider: 'github', icon: Github, color: 'bg-[#333] hover:bg-[#555] text-white', - description: 'Continue with GitHub' + description: 'Continue with GitHub', + enabled: true }, { name: 'Google', provider: 'google', icon: Chrome, - color: 'bg-white hover:bg-gray-50 text-gray-900 border border-gray-300', - description: 'Continue with Google' + color: 'bg-gray-300 text-gray-500 cursor-not-allowed', + description: 'Continue with Google (Demo Disabled)', + enabled: false }, { name: 'Discord', provider: 'discord', icon: MessageCircle, - color: 'bg-[#5865F2] hover:bg-[#4752C4] text-white', - description: 'Continue with Discord' + color: 'bg-gray-300 text-gray-500 cursor-not-allowed', + description: 'Continue with Discord (Demo Disabled)', + enabled: false }, { name: 'Twitter', provider: 'twitter', icon: Twitter, - color: 'bg-[#1DA1F2] hover:bg-[#1A91DA] text-white', - description: 'Continue with Twitter' + color: 'bg-gray-300 text-gray-500 cursor-not-allowed', + description: 'Continue with Twitter (Demo Disabled)', + enabled: false } ]; async function handleSubmit(e: Event) { e.preventDefault(); + + // Disable email/password authentication for demo + toaster.create({ + type: 'warning', + title: 'Demo Mode', + description: 'Email/password authentication is disabled in this demo. Please use GitHub login instead.' + }); + return; + + // Original code commented out for demo + /* loading = true; message = ''; @@ -110,9 +125,20 @@ } finally { loading = false; } + */ } async function handleOAuth(provider: string) { + // Only allow GitHub for demo + if (provider !== 'github') { + toaster.create({ + type: 'warning', + title: 'Demo Mode', + description: `${provider.charAt(0).toUpperCase() + provider.slice(1)} login is disabled in this demo. Only GitHub login is available.` + }); + return; + } + oauthLoading = provider; try { const { error } = await supabase.auth.signInWithOAuth({ @@ -149,6 +175,20 @@
+ This is a demo deployment. Only GitHub login is enabled. + Email/password authentication and other OAuth providers are disabled for demonstration purposes. +
+