Blame view

src/pages/Authentication/Login.vue 4.94 KB
93a68cfa1   Jatinder Singh   first commit
1
  <template>
03dcbf0c1   Neeraj Sharma   fix all api and r...
2
    <v-app id="login">
603a06702   Neeraj Sharma   implemented chang...
3
      <v-toolbar  class="fixcolor">
93a68cfa1   Jatinder Singh   first commit
4
        <v-toolbar-items>
55f72b7d7   Neeraj Sharma   add new page are ...
5
          <img src="/static/icon.jpeg" height="36" alt="logo">
2b0e316ee   Neeraj Sharma   upload mytiple im...
6
          <h3 class="white--text my-3 ml-5 logoSchool">School-Maagement</h3>
03dcbf0c1   Neeraj Sharma   fix all api and r...
7
8
        </v-toolbar-items>
      </v-toolbar>
93a68cfa1   Jatinder Singh   first commit
9
10
      <v-content>
        <v-container fluid fill-height>
03dcbf0c1   Neeraj Sharma   fix all api and r...
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   Jatinder Singh   first commit
19
          <v-layout align-center justify-center>
03dcbf0c1   Neeraj Sharma   fix all api and r...
20
            <v-flex xs12 sm10 md6 lg4>
603a06702   Neeraj Sharma   implemented chang...
21
              <v-toolbar class="fixcolor" dark>
03dcbf0c1   Neeraj Sharma   fix all api and r...
22
                <v-spacer></v-spacer>
e3e2a04c6   Neeraj Sharma   first commit
23
                <v-toolbar-title>School Login</v-toolbar-title>
03dcbf0c1   Neeraj Sharma   fix all api and r...
24
25
                <v-spacer></v-spacer>
              </v-toolbar>
04e3fbc56   Jatinder Singh   minor fix
26
              <v-card class="elevation-1 pa-1">
03dcbf0c1   Neeraj Sharma   fix all api and r...
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   Neeraj Sharma   first commit
31
                        v-model="userLogincredentials.email"
03dcbf0c1   Neeraj Sharma   fix all api and r...
32
33
34
35
36
                        :rules="nameRules"
                        label="Username"
                        required
                      ></v-text-field>
                      <v-text-field
e3e2a04c6   Neeraj Sharma   first commit
37
                        :rules="[rules.required]"
03dcbf0c1   Neeraj Sharma   fix all api and r...
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   Neeraj Sharma   implemented chang...
49
                        <!-- <v-checkbox :label="`Remember me`" v-model="remember"></v-checkbox> -->
03dcbf0c1   Neeraj Sharma   fix all api and r...
50
51
                      </v-flex>
                      <v-flex xs6>
ac10393a4   Neeraj Sharma   add calender date...
52
                       <h5  class="right mt-4"> <router-link class="link" to="/forgetpassword" style="border-bottom: 2px solid #aaa;">Forgot Password</router-link></h5>
03dcbf0c1   Neeraj Sharma   fix all api and r...
53
54
                    </v-flex>
                     </v-layout>
93a68cfa1   Jatinder Singh   first commit
55
                  </v-flex>
03dcbf0c1   Neeraj Sharma   fix all api and r...
56
57
                </v-card-text>
                <v-layout>
03dcbf0c1   Neeraj Sharma   fix all api and r...
58
                <v-flex sm12 class="my-3">
603a06702   Neeraj Sharma   implemented chang...
59
                  <v-btn style="margin: auto;display: block;b" class="fixcolor" round dark large @click="login" :loading="loading">Login</v-btn>           
03dcbf0c1   Neeraj Sharma   fix all api and r...
60
61
                </v-flex>
                 </v-layout>
c7a4fe86a   Neeraj Sharma   responsive admin ...
62
                 <v-layout>
c7a4fe86a   Neeraj Sharma   responsive admin ...
63
                </v-layout>
93a68cfa1   Jatinder Singh   first commit
64
65
66
67
68
              </v-card>
            </v-flex>
          </v-layout>
        </v-container>
      </v-content>
603a06702   Neeraj Sharma   implemented chang...
69
      <v-footer class="pa-4"  style="background:linear-gradient(90deg,#f58753 30%,#f15e5f 110%)"></v-footer>
03dcbf0c1   Neeraj Sharma   fix all api and r...
70
    </v-app>
93a68cfa1   Jatinder Singh   first commit
71
72
73
  </template>
  
  <script>
03dcbf0c1   Neeraj Sharma   fix all api and r...
74
  import http from "@/Services/http.js";
93a68cfa1   Jatinder Singh   first commit
75
  export default {
03dcbf0c1   Neeraj Sharma   fix all api and r...
76
    data() {
93a68cfa1   Jatinder Singh   first commit
77
      return {
03dcbf0c1   Neeraj Sharma   fix all api and r...
78
79
80
81
82
83
        snackbar: false,
        y: "top",
        x: "right",
        mode: "",
        timeout: 3000,
        text: "",
93a68cfa1   Jatinder Singh   first commit
84
85
86
87
        e1: true,
        loading: false,
        remember: false,
        valid: false,
b34ed827a   Jatinder Singh   changes
88
        userLogincredentials: {},
04e3fbc56   Jatinder Singh   minor fix
89
        nameRules: [
03dcbf0c1   Neeraj Sharma   fix all api and r...
90
          v => !!v || "Username is required"
e3e2a04c6   Neeraj Sharma   first commit
91

04e3fbc56   Jatinder Singh   minor fix
92
        ],
03dcbf0c1   Neeraj Sharma   fix all api and r...
93
        password: "",
e3e2a04c6   Neeraj Sharma   first commit
94
        email:"",
07095d4d8   Jatinder Singh   regex
95
        rules: {
03dcbf0c1   Neeraj Sharma   fix all api and r...
96
          required: value => !!value || "password is Required.",
e3e2a04c6   Neeraj Sharma   first commit
97
98
99
100
          // min: v =>
          //   (/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/.test(
          //     v
          //   ) &&
f0281dd43   Neeraj Sharma   add run api of re...
101
          //     v.length >= 6) ||
e3e2a04c6   Neeraj Sharma   first commit
102
          //   "Min 4 characters upper case lower case symbol required"
03dcbf0c1   Neeraj Sharma   fix all api and r...
103
        }
93a68cfa1   Jatinder Singh   first commit
104
105
106
      };
    },
    methods: {
03dcbf0c1   Neeraj Sharma   fix all api and r...
107
      login() {
55f72b7d7   Neeraj Sharma   add new page are ...
108
       this.loading = true;
e173bab21   Jatinder Singh   api
109
        var userdata = {
e3e2a04c6   Neeraj Sharma   first commit
110
111
112
113
          email: this.userLogincredentials.email,
          password: this.userLogincredentials.password,
          role:"ADMIN"
          
03dcbf0c1   Neeraj Sharma   fix all api and r...
114
115
        };
        http()
e3e2a04c6   Neeraj Sharma   first commit
116
          .post("/schoolLogin", userdata)
e173bab21   Jatinder Singh   api
117
          .then(response => {
03dcbf0c1   Neeraj Sharma   fix all api and r...
118
            this.$store.dispatch("setToken", response.data.data.token);
e3e2a04c6   Neeraj Sharma   first commit
119
            this.$store.dispatch("Id", response.data.data.id);
55f72b7d7   Neeraj Sharma   add new page are ...
120
121
            this.loading = false;
            this.$router.push("/teachers");
03dcbf0c1   Neeraj Sharma   fix all api and r...
122
          })
55f72b7d7   Neeraj Sharma   add new page are ...
123
124
          .catch(error => {
            this.text = error.response.data.message
03dcbf0c1   Neeraj Sharma   fix all api and r...
125
126
127
            this.snackbar = true;
            this.loading = false;
          });
2b0e316ee   Neeraj Sharma   upload mytiple im...
128
        this.$router.push("/teachers");
03dcbf0c1   Neeraj Sharma   fix all api and r...
129
130
131
132
133
      }
    },
    computed: {
      color() {
        return this.loading ? "success" : "error";
4413a8d93   Jatinder Singh   changes
134
      }
93a68cfa1   Jatinder Singh   first commit
135
136
    }
  };
93a68cfa1   Jatinder Singh   first commit
137
138
139
  </script>
  
  <style scoped lang="css">
03dcbf0c1   Neeraj Sharma   fix all api and r...
140
141
142
143
144
145
146
147
  #login {
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    content: "";
    z-index: 0;
  }
93a68cfa1   Jatinder Singh   first commit
148
  </style>
04e3fbc56   Jatinder Singh   minor fix
149
  <style scoped>
03dcbf0c1   Neeraj Sharma   fix all api and r...
150
151
152
  img {
    position: absolute;
    top: 13px;
55f72b7d7   Neeraj Sharma   add new page are ...
153
    left: 8px;
04e3fbc56   Jatinder Singh   minor fix
154
155
  }
  .v-btn--large {
03dcbf0c1   Neeraj Sharma   fix all api and r...
156
    padding: 0px 84px;
93a68cfa1   Jatinder Singh   first commit
157
  }
03dcbf0c1   Neeraj Sharma   fix all api and r...
158
159
  .link{ 
    text-decoration:none;
04e3fbc56   Jatinder Singh   minor fix
160
  }
03dcbf0c1   Neeraj Sharma   fix all api and r...
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   Neeraj Sharma   finally fix
175
  img{
55f72b7d7   Neeraj Sharma   add new page are ...
176
177
  top: 21px;
  left: 10px;
a0fe54618   Neeraj Sharma   finally fix
178
  height: 24px;
55f72b7d7   Neeraj Sharma   add new page are ...
179
180
181
182
183
184
185
186
  width: 33px;
  }
  .logoSchool{
  font-size: 18px;
  margin-top: 20px !important;
  }
  h5 {
      font-size: 14px !important;
a0fe54618   Neeraj Sharma   finally fix
187
  }
4413a8d93   Jatinder Singh   changes
188
  }
93a68cfa1   Jatinder Singh   first commit
189
  </style>