crbtc.org/pages/login.vue

62 lines
1.4 KiB
Vue
Raw Normal View History

2023-07-28 00:17:00 +00:00
<script setup>
useHead({
title: 'Sign in | crbtc.org',
meta: [
{
name: 'description',
content: ``
},
],
})
2023-07-28 01:44:21 +00:00
import { Field, Form } from 'vee-validate';
function required(value) {
return value ? true : 'This field is required';
}
const { login } = useDirectusAuth();
const router = useRouter();
const onSubmit = async (values) => {
console.log(values.email);
try {
await login({
email: values.email,
password: values.password
});
} catch (e) {}
};
2023-07-28 00:17:00 +00:00
</script>
2023-07-17 19:11:13 +00:00
<template>
<div class="login">
2023-07-28 00:17:00 +00:00
<h3>Sign in to your account</h3>
<h4 class="policy">By continuing, you agree to our <NuxtLink href="terms">Terms of
use</NuxtLink> and <NuxtLink href="privacy">Privacy policy</NuxtLink>.</h4>
2023-07-28 01:44:21 +00:00
<Form v-slot="{ errors }" @submit="onSubmit" >
2023-07-28 00:17:00 +00:00
<div class="input">
<label>Email</label>
2023-07-28 01:44:21 +00:00
<Field name="email" :rules="required" placeholder="Enter your email" />
<span>{{ errors.field }}</span>
2023-07-28 00:17:00 +00:00
</div>
<div class="input">
<label>Password</label>
2023-07-28 01:44:21 +00:00
<Field name="password" :rules="required" placeholder="********" type="password" />
2023-07-28 00:17:00 +00:00
</div>
<button>Sign in</button>
2023-07-28 01:44:21 +00:00
</Form>
2023-07-28 00:17:00 +00:00
<p class="newbie">Don't have an account? <NuxtLink href="/register">Create account</NuxtLink></p>
<p class="reset">Forgot password? <NuxtLink href="/reset">Reset password</NuxtLink></p>
2023-07-17 19:11:13 +00:00
</div>
</template>