Skip to content

Commit 759c074

Browse files
committed
added login
1 parent 9f7ab86 commit 759c074

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed

resources/js/Pages/Login.vue

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<template>
2+
<modal-layout class="white" title="Login">
3+
<template v-slot:toolbar>
4+
<v-toolbar flat width="100%" class="accent">
5+
<v-btn text icon color="white" @click="back()">
6+
<v-icon>arrow_back</v-icon>
7+
</v-btn>
8+
<v-spacer />
9+
<v-toolbar-title class="text-xs-center white--text">Login Page</v-toolbar-title>
10+
<v-spacer />
11+
</v-toolbar>
12+
</template>
13+
14+
<v-container fill-height>
15+
<v-row justify="center" align="center">
16+
<v-col justify="center" align="center" cols="12" xl="4" lg="4" md="8" xs="10" sm="10">
17+
<form @submit.prevent="login()">
18+
<v-text-field
19+
v-model="form.email"
20+
v-validate="'required|email'"
21+
:error-messages="errorMessages('email')"
22+
:class="{ 'error--text': hasErrors('email') }"
23+
class="primary--text"
24+
name="username"
25+
label="Type Your Account Email"
26+
data-vv-name="email"
27+
prepend-icon="email"
28+
counter="255"
29+
/>
30+
31+
<v-text-field
32+
v-model="form.password"
33+
v-validate="'required|min:8'"
34+
:append-icon="icon"
35+
:type="!password_visible ? 'password' : 'text'"
36+
:error-messages="errorMessages('password')"
37+
:class="{ 'error--text': hasErrors('password') }"
38+
class="primary--text"
39+
name="password"
40+
label="Enter your password"
41+
hint="At least 8 characters"
42+
data-vv-name="password"
43+
counter="255"
44+
prepend-icon="fa-key"
45+
@click:append="() => (password_visible = !password_visible)"
46+
/>
47+
48+
<v-btn :loading="form.busy" :disabled="errors.any()" block type="submit" color="accent">
49+
Log In
50+
<v-icon right colo="primary">fa-sign-in</v-icon>
51+
</v-btn>
52+
</form>
53+
</v-col>
54+
</v-row>
55+
</v-container>
56+
</modal-layout>
57+
</template>
58+
59+
<script>
60+
import Form from "vform";
61+
import ModalLayout from "../layouts/ModalLayout";
62+
import validationError from "../mixins/validation-error";
63+
export default {
64+
components: {
65+
ModalLayout
66+
},
67+
mixins: [validationError],
68+
data: () => ({
69+
form: new Form({
70+
username: "",
71+
email: "",
72+
password: "",
73+
remember: null
74+
}),
75+
password_visible: false,
76+
drawer: null
77+
}),
78+
computed: {
79+
icon() {
80+
return this.password_visible ? "visibility" : "visibility_off";
81+
}
82+
},
83+
methods: {
84+
login() {
85+
let self = this;
86+
self.$validator.validateAll();
87+
if (!self.errors.any()) {
88+
self.$inertia.post(self.route("login.attempt"), self.form);
89+
}
90+
},
91+
back() {
92+
this.$inertia.visit("/");
93+
}
94+
}
95+
};
96+
</script>
97+
98+
<style lang="scss">
99+
</style>

0 commit comments

Comments
 (0)