Security handening

This commit is contained in:
Roman Krček
2025-08-07 16:28:07 +02:00
parent 6ed1f985e0
commit c95f96594f
8 changed files with 188 additions and 142 deletions

View File

@@ -1,7 +1,11 @@
<script lang="ts">
import { currentStep } from '$lib/stores.js';
import { isSignedIn, handleSignIn, handleSignOut, isGoogleApiReady } from '$lib/google';
import { isSignedIn, handleSignOut, requestTokenFromUser } from '$lib/google';
import Navigator from './subcomponents/Navigator.svelte';
function handleSignIn() {
requestTokenFromUser();
}
</script>
<div class="p-6">
@@ -79,34 +83,9 @@
</p>
<button
onclick={handleSignIn}
disabled={!$isGoogleApiReady}
class="flex w-full items-center justify-center rounded-lg bg-blue-600 px-4 py-3 font-semibold text-white transition-colors hover:bg-blue-700 disabled:cursor-not-allowed disabled:bg-gray-400"
>
{#if $isGoogleApiReady}
Sign In with Google
{:else}
<svg
class="mr-2 h-5 w-5 animate-spin text-white"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
>
<circle
class="opacity-25"
cx="12"
cy="12"
r="10"
stroke="currentColor"
stroke-width="4"
></circle>
<path
class="opacity-75"
fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
></path>
</svg>
Loading Google API...
{/if}
Sign In with Google
</button>
</div>
{/if}