Blame view
src/pages/Authentication/Login.vue
4.94 KB
93a68cfa1
|
1 |
<template> |
03dcbf0c1
|
2 |
<v-app id="login"> |
603a06702
|
3 |
<v-toolbar class="fixcolor"> |
93a68cfa1
|
4 |
<v-toolbar-items> |
55f72b7d7
|
5 |
<img src="/static/icon.jpeg" height="36" alt="logo"> |
2b0e316ee
|
6 |
<h3 class="white--text my-3 ml-5 logoSchool">School-Maagement</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 |
<v-flex xs12 sm10 md6 lg4> |
603a06702
|
21 |
<v-toolbar class="fixcolor" dark> |
03dcbf0c1
|
22 |
<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 |
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> |
603a06702
|
49 |
<!-- <v-checkbox :label="`Remember me`" v-model="remember"></v-checkbox> --> |
03dcbf0c1
|
50 51 |
</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 |
<v-flex sm12 class="my-3"> |
603a06702
|
59 |
<v-btn style="margin: auto;display: block;b" class="fixcolor" round dark large @click="login" :loading="loading">Login</v-btn> |
03dcbf0c1
|
60 61 |
</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> |
603a06702
|
69 |
<v-footer class="pa-4" style="background:linear-gradient(90deg,#f58753 30%,#f15e5f 110%)"></v-footer> |
03dcbf0c1
|
70 |
</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 |
// min: v => // (/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/.test( // v // ) && |
f0281dd43
|
101 |
// v.length >= 6) || |
e3e2a04c6
|
102 |
// "Min 4 characters upper case lower case symbol required" |
03dcbf0c1
|
103 |
} |
93a68cfa1
|
104 105 106 |
}; }, methods: { |
03dcbf0c1
|
107 |
login() { |
55f72b7d7
|
108 |
this.loading = true; |
e173bab21
|
109 |
var userdata = { |
e3e2a04c6
|
110 111 112 113 |
email: this.userLogincredentials.email, password: this.userLogincredentials.password, role:"ADMIN" |
03dcbf0c1
|
114 115 |
}; http() |
e3e2a04c6
|
116 |
.post("/schoolLogin", userdata) |
e173bab21
|
117 |
.then(response => { |
03dcbf0c1
|
118 |
this.$store.dispatch("setToken", response.data.data.token); |
e3e2a04c6
|
119 |
this.$store.dispatch("Id", response.data.data.id); |
55f72b7d7
|
120 121 |
this.loading = false; this.$router.push("/teachers"); |
03dcbf0c1
|
122 |
}) |
55f72b7d7
|
123 124 |
.catch(error => { this.text = error.response.data.message |
03dcbf0c1
|
125 126 127 |
this.snackbar = true; this.loading = false; }); |
2b0e316ee
|
128 |
this.$router.push("/teachers"); |
03dcbf0c1
|
129 130 131 132 133 |
} }, computed: { color() { return this.loading ? "success" : "error"; |
4413a8d93
|
134 |
} |
93a68cfa1
|
135 136 |
} }; |
93a68cfa1
|
137 138 139 |
</script> <style scoped lang="css"> |
03dcbf0c1
|
140 141 142 143 144 145 146 147 |
#login { width: 100%; position: absolute; top: 0; left: 0; content: ""; z-index: 0; } |
93a68cfa1
|
148 |
</style> |
04e3fbc56
|
149 |
<style scoped> |
03dcbf0c1
|
150 151 152 |
img { position: absolute; top: 13px; |
55f72b7d7
|
153 |
left: 8px; |
04e3fbc56
|
154 155 |
} .v-btn--large { |
03dcbf0c1
|
156 |
padding: 0px 84px; |
93a68cfa1
|
157 |
} |
03dcbf0c1
|
158 159 |
.link{ text-decoration:none; |
04e3fbc56
|
160 |
} |
03dcbf0c1
|
161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
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
|
175 |
img{ |
55f72b7d7
|
176 177 |
top: 21px; left: 10px; |
a0fe54618
|
178 |
height: 24px; |
55f72b7d7
|
179 180 181 182 183 184 185 186 |
width: 33px; } .logoSchool{ font-size: 18px; margin-top: 20px !important; } h5 { font-size: 14px !important; |
a0fe54618
|
187 |
} |
4413a8d93
|
188 |
} |
93a68cfa1
|
189 |
</style> |