style signin and legal pages

This commit is contained in:
Michael Dausmann
2023-04-22 23:52:36 +10:00
parent a5f894d59a
commit b98c9a7bfb
5 changed files with 69 additions and 83 deletions

View File

@@ -8,20 +8,7 @@
const email = ref('')
const password = ref('')
const handleOtpLogin = async () => {
try {
loading.value = true
const { error } = await supabase.auth.signInWithOtp({ email: email.value })
if (error) throw error
alert('Check your email for the login link!')
} catch (error) {
alert(error)
} finally {
loading.value = false
}
}
const handleStandardLogin = async () => {
const handleStandardSignin = async () => {
try {
loading.value = true
const { error } = await supabase.auth.signInWithPassword({ email: email.value, password: password.value })
@@ -41,28 +28,31 @@
})
</script>
<template>
<div>
<h3>Sign In</h3>
<form @submit.prevent="handleStandardLogin">
<label for="email">Email:</label>
<input class="inputField" type="email" id="email" placeholder="Your email" v-model="email" />
<label for="password">Password:</label>
<input class="inputField" type="password" id="password" placeholder="Password" v-model="password" />
<p>By signing in, I agree to the <NuxtLink to="/privacy">Privacy Statement</NuxtLink> and <NuxtLink to="/terms">Terms of Service</NuxtLink>.</p>
<button type="submit" :disabled="loading">Sign In</button>
</form>
<form @submit.prevent="handleOtpLogin">
<label for="email">Email:</label>
<input class="inputField" type="email" id="email" placeholder="Your email" v-model="email" />
<p>By signing in, I agree to the <NuxtLink to="/privacy">Privacy Statement</NuxtLink> and <NuxtLink to="/terms">Terms of Service</NuxtLink>.</p>
<button type="submit" :disabled="loading">Sign In using Magic Link</button>
</form>
<p>or sign in with</p>
<button @click="supabase.auth.signInWithOAuth({provider: 'google'})">Google</button>
<div class="flex flex-col items-center justify-center h-screen bg-gray-100">
<div class="w-full max-w-md p-6 space-y-6 bg-white rounded-lg shadow-lg">
<h1 class="text-3xl font-bold text-center">Sign in</h1>
<form @submit.prevent="handleStandardSignin" class="space-y-4">
<div>
<label for="email" class="block mb-2 font-bold">Email</label>
<input v-model="email" id="email" type="email" class="w-full p-2 border border-gray-400 rounded-md"
placeholder="Enter your email" required>
</div>
<div>
<label for="password" class="block mb-2 font-bold">Password</label>
<input v-model="password" id="password" type="password" class="w-full p-2 border border-gray-400 rounded-md"
placeholder="Enter your password" required>
</div>
<button :disabled="loading || password === ''" type="submit"
class="w-full py-2 text-white bg-indigo-600 rounded-md hover:bg-indigo-700">Sign in</button>
</form>
<p class="text-center">or</p>
<button @click="supabase.auth.signInWithOAuth({ provider: 'google' })"
class="w-full py-2 text-white bg-red-600 rounded-md hover:bg-red-700">
<span class="flex items-center justify-center space-x-2">
<Icon name="fa-brands:google" class="w-5 h-5" />
<span>Sign in with Google</span>
</span>
</button>
</div>
</div>
</template>