2026-02-24 00:20:54 -06:00
|
|
|
<script lang="ts" setup>
|
2026-04-10 18:10:01 -05:00
|
|
|
import incorrectPasswordGif from '~/assets/img/incorrect-password.gif';
|
|
|
|
|
|
2026-02-24 00:20:54 -06:00
|
|
|
const email = ref("");
|
|
|
|
|
const password = ref("");
|
|
|
|
|
const {login} = useAuth();
|
|
|
|
|
|
2026-04-10 18:10:01 -05:00
|
|
|
const errorMessage = ref("");
|
|
|
|
|
|
|
|
|
|
const handleLogin = async () => {
|
|
|
|
|
try {
|
|
|
|
|
await login(email.value, password.value)
|
|
|
|
|
} catch (error) {
|
|
|
|
|
errorMessage.value = "Invalid email or password";
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-02-24 00:20:54 -06:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<form class="password-form" @submit.prevent="handleLogin">
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label for="email">Email</label>
|
2026-04-08 19:04:15 -05:00
|
|
|
<input
|
|
|
|
|
id="email"
|
|
|
|
|
v-model="email"
|
|
|
|
|
autocomplete="email"
|
|
|
|
|
type="email"
|
|
|
|
|
/>
|
2026-02-24 00:20:54 -06:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label for="password">Password</label>
|
2026-04-08 19:04:15 -05:00
|
|
|
<input
|
|
|
|
|
id="password"
|
|
|
|
|
v-model="password"
|
|
|
|
|
autocomplete="current-password"
|
|
|
|
|
type="password"
|
|
|
|
|
/>
|
2026-02-24 00:20:54 -06:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<button type="submit">Submit</button>
|
2026-04-10 18:10:01 -05:00
|
|
|
<div class="error-container">
|
|
|
|
|
<p v-if="errorMessage" class="error-message">{{ errorMessage }}</p>
|
|
|
|
|
<img v-if="errorMessage" :src="incorrectPasswordGif" alt="You didn't say the magic word." class="error-image"
|
|
|
|
|
height="200" width="300"/>
|
|
|
|
|
</div>
|
2026-02-24 00:20:54 -06:00
|
|
|
</form>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2026-04-10 18:10:01 -05:00
|
|
|
.error-container {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 1rem;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-25 17:33:37 -06:00
|
|
|
.password-form {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: 1rem;
|
|
|
|
|
max-width: 50rem;
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-24 00:20:54 -06:00
|
|
|
.form-group {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: 1rem;
|
|
|
|
|
}
|
2026-04-10 18:10:01 -05:00
|
|
|
|
|
|
|
|
.error-message {
|
|
|
|
|
color: red;
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
2026-02-24 00:20:54 -06:00
|
|
|
</style>
|