Blame view
src/pages/Login.vue
4.88 KB
93a68cfa1
|
1 |
<template> |
03dcbf0c1
|
2 |
<v-app id="login"> |
93a68cfa1
|
3 4 |
<v-toolbar color="grey lighten"> <v-toolbar-items> |
e3e2a04c6
|
5 6 |
<!-- <img src="/static/ana@2x.png" height="36" alt="ana"> --> <h3 class="white--text my-3 ml-4">School-Management</h3> |
03dcbf0c1
|
7 8 |
</v-toolbar-items> </v-toolbar> |
93a68cfa1
|
9 10 |
<v-content> <v-container fluid fill-height> |
03dcbf0c1
|
11 12 13 14 15 16 17 18 |
<v-snackbar :timeout="timeout" :top="y === 'top'" :right="x === 'right'" :vertical="mode === 'vertical'" v-model="snackbar" :color="color" >{{ text }}</v-snackbar> |
93a68cfa1
|
19 |
<v-layout align-center justify-center> |
03dcbf0c1
|
20 21 22 |
<v-flex xs12 sm10 md6 lg4> <v-toolbar color="black" dark> <v-spacer></v-spacer> |
e3e2a04c6
|
23 |
<v-toolbar-title>School Login</v-toolbar-title> |
03dcbf0c1
|
24 25 |
<v-spacer></v-spacer> </v-toolbar> |
04e3fbc56
|
26 |
<v-card class="elevation-1 pa-1"> |
03dcbf0c1
|
27 28 29 30 |
<v-card-text> <v-flex xs12 sm12 md12 lg12> <v-form ref="form" v-model="valid" lazy-validation> <v-text-field |
e3e2a04c6
|
31 |
v-model="userLogincredentials.email" |
03dcbf0c1
|
32 33 34 35 36 |
:rules="nameRules" label="Username" required ></v-text-field> <v-text-field |
e3e2a04c6
|
37 |
:rules="[rules.required]" |
03dcbf0c1
|
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
v-model="userLogincredentials.password" :append-icon="e1 ? 'visibility_off' : 'visibility'" :append-icon-cb="() => (e1 = !e1)" :type="e1 ? 'password' : 'text'" name="input-10-1" label="Password" counter ></v-text-field> </v-form> <v-layout row wrap> <v-flex xs6> <v-checkbox :label="`Remember me`" v-model="remember"></v-checkbox> </v-flex> <v-flex xs6> |
ac10393a4
|
52 |
<h5 class="right mt-4"> <router-link class="link" to="/forgetpassword" style="border-bottom: 2px solid #aaa;">Forgot Password</router-link></h5> |
03dcbf0c1
|
53 54 |
</v-flex> </v-layout> |
93a68cfa1
|
55 |
</v-flex> |
03dcbf0c1
|
56 57 |
</v-card-text> <v-layout> |
03dcbf0c1
|
58 59 60 61 |
<v-flex sm12 class="my-3"> <v-btn style="margin: auto;display: block;" round color="black" dark large @click="login" :loading="loading">Login</v-btn> </v-flex> </v-layout> |
c7a4fe86a
|
62 |
<v-layout> |
c7a4fe86a
|
63 |
</v-layout> |
93a68cfa1
|
64 65 66 67 68 |
</v-card> </v-flex> </v-layout> </v-container> </v-content> |
03dcbf0c1
|
69 70 |
<v-footer class="pa-4" color="grey darken-2"></v-footer> </v-app> |
93a68cfa1
|
71 72 73 |
</template> <script> |
03dcbf0c1
|
74 |
import http from "@/Services/http.js"; |
93a68cfa1
|
75 |
export default { |
03dcbf0c1
|
76 |
data() { |
93a68cfa1
|
77 |
return { |
03dcbf0c1
|
78 79 80 81 82 83 |
snackbar: false, y: "top", x: "right", mode: "", timeout: 3000, text: "", |
93a68cfa1
|
84 85 86 87 |
e1: true, loading: false, remember: false, valid: false, |
b34ed827a
|
88 |
userLogincredentials: {}, |
04e3fbc56
|
89 |
nameRules: [ |
03dcbf0c1
|
90 |
v => !!v || "Username is required" |
e3e2a04c6
|
91 |
|
04e3fbc56
|
92 |
], |
03dcbf0c1
|
93 |
password: "", |
e3e2a04c6
|
94 |
email:"", |
07095d4d8
|
95 |
rules: { |
03dcbf0c1
|
96 |
required: value => !!value || "password is Required.", |
e3e2a04c6
|
97 98 99 100 101 102 |
// min: v => // (/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/.test( // v // ) && // v.length >= 4) || // "Min 4 characters upper case lower case symbol required" |
03dcbf0c1
|
103 |
} |
93a68cfa1
|
104 105 106 |
}; }, methods: { |
03dcbf0c1
|
107 |
login() { |
e173bab21
|
108 |
var userdata = { |
e3e2a04c6
|
109 110 111 112 |
email: this.userLogincredentials.email, password: this.userLogincredentials.password, role:"ADMIN" |
03dcbf0c1
|
113 114 |
}; http() |
e3e2a04c6
|
115 |
.post("/schoolLogin", userdata) |
e173bab21
|
116 |
.then(response => { |
03dcbf0c1
|
117 |
this.$store.dispatch("setToken", response.data.data.token); |
e3e2a04c6
|
118 |
this.$store.dispatch("Id", response.data.data.id); |
03dcbf0c1
|
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
this.loading = true; if ((this.snackbar = true)) { this.text = "Successfully Login"; } setTimeout(() => { this.$router.push("/dashboard"); }, 2000); }) .catch(err => { this.text = "Email or Password not matched !!"; this.snackbar = true; this.loading = false; }); } }, computed: { color() { return this.loading ? "success" : "error"; |
4413a8d93
|
137 |
} |
93a68cfa1
|
138 139 |
} }; |
93a68cfa1
|
140 141 142 |
</script> <style scoped lang="css"> |
03dcbf0c1
|
143 144 145 146 147 148 149 150 |
#login { width: 100%; position: absolute; top: 0; left: 0; content: ""; z-index: 0; } |
93a68cfa1
|
151 |
</style> |
04e3fbc56
|
152 |
<style scoped> |
03dcbf0c1
|
153 154 155 156 |
img { position: absolute; top: 13px; left: 50px; |
04e3fbc56
|
157 158 |
} .v-btn--large { |
03dcbf0c1
|
159 |
padding: 0px 84px; |
93a68cfa1
|
160 |
} |
03dcbf0c1
|
161 162 |
.link{ text-decoration:none; |
04e3fbc56
|
163 |
} |
03dcbf0c1
|
164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
a { color: #696969; } .forget{ margin-top:20px; } .mt-4 { margin-top: 21px !important; } @media screen and (max-width: 600px) { .forget{ margin-top:none; margin-left:18px; } |
a0fe54618
|
178 179 180 181 182 183 |
img{ top:16px; left:10px; height: 24px; width: 66px;; } |
4413a8d93
|
184 |
} |
93a68cfa1
|
185 |
</style> |