Blame view

src/pages/Login.vue 3.91 KB
93a68cfa1   Jatinder Singh   first commit
1
2
3
4
5
6
7
8
9
10
11
12
  <template>
   
   <v-app id="login">
      <v-toolbar color="grey lighten">
        <v-toolbar-items>
           <img src="/static/ana@2x.png" height="36" alt="ana">
      </v-toolbar-items>
    </v-toolbar>
    
      <v-content>
        <v-container fluid fill-height>
          <v-layout align-center justify-center>
04e3fbc56   Jatinder Singh   minor fix
13
            <v-flex xs12 sm8 md6 lg5>
07095d4d8   Jatinder Singh   regex
14
15
            <v-toolbar color="black" dark>
            <v-spacer></v-spacer>
93a68cfa1   Jatinder Singh   first commit
16
17
18
19
            <v-toolbar-title>Admin Login</v-toolbar-title>
            <v-spacer></v-spacer>
          </v-toolbar>
           
04e3fbc56   Jatinder Singh   minor fix
20
21
22
              <v-card class="elevation-1 pa-1">
                 <v-card-text>
                 <v-flex xs12 sm8 md8 lg8 offset-xs2>   
4413a8d93   Jatinder Singh   changes
23
                   <v-form ref="form" v-model="valid" lazy-validation>                           
93a68cfa1   Jatinder Singh   first commit
24
                   <v-text-field
c1fd43e24   Jatinder Singh   changes
25
                   v-model="userLogincredentials.userName"
04e3fbc56   Jatinder Singh   minor fix
26
27
28
29
                   :rules="nameRules"
                   label="Username"
                   required
                   ></v-text-field>
93a68cfa1   Jatinder Singh   first commit
30
                <v-text-field
07095d4d8   Jatinder Singh   regex
31
                  :rules="[rules.required, rules.min]"
c1fd43e24   Jatinder Singh   changes
32
                  v-model="userLogincredentials.password"
04e3fbc56   Jatinder Singh   minor fix
33
                  :append-icon="e1 ? 'visibility_off' : 'visibility'"
93a68cfa1   Jatinder Singh   first commit
34
35
                  :append-icon-cb="() => (e1 = !e1)"
                  :type="e1 ? 'password' : 'text'"
93a68cfa1   Jatinder Singh   first commit
36
37
                  name="input-10-1"
                  label="Password"
93a68cfa1   Jatinder Singh   first commit
38
                  counter
07095d4d8   Jatinder Singh   regex
39
                  
93a68cfa1   Jatinder Singh   first commit
40
                ></v-text-field>
07095d4d8   Jatinder Singh   regex
41
      
04e3fbc56   Jatinder Singh   minor fix
42
                </v-form></v-flex>
07095d4d8   Jatinder Singh   regex
43
              </v-card-text>
09f34e0c8   Jatinder Singh   notification page
44
45
              <v-flex xs12 sm8 md8 lg8 offset-xs2>  
              
f84ff8f5a   Jatinder Singh   report page changes
46
47
48
49
               <v-checkbox 
                  :label="`Remember me`" 
                  v-model="remember"
                ></v-checkbox>
09f34e0c8   Jatinder Singh   notification page
50
            
4413a8d93   Jatinder Singh   changes
51
                  <h5 id="fp"> <router-link to="/forgetpassword">Forget Password</router-link></h5>
09f34e0c8   Jatinder Singh   notification page
52
                
04e3fbc56   Jatinder Singh   minor fix
53
54
55
              </v-flex>
              
               <v-flex class="mt-3 text-md-center">
93a68cfa1   Jatinder Singh   first commit
56
57
58
59
60
61
62
                  <v-btn round color="black" dark large @click="login" :loading="loading">Login</v-btn>
                  </v-flex>
              </v-card>
            </v-flex>
          </v-layout>
        </v-container>
      </v-content>
07095d4d8   Jatinder Singh   regex
63
64
65
    <v-footer class="pa-4" color="grey darken-2">
  </v-footer>
  </v-app>
93a68cfa1   Jatinder Singh   first commit
66
67
68
69
70
71
72
73
74
75
76
  </template>
  
  <script>
  import axios from 'axios';
  export default {
    data () {
      return {
        e1: true,
        loading: false,
        remember: false,
        valid: false,
b34ed827a   Jatinder Singh   changes
77
        userLogincredentials: {},
04e3fbc56   Jatinder Singh   minor fix
78
79
80
81
82
83
84
85
86
87
        username: '',
        nameRules: [
          v => !!v || 'Username is required',
        //  v => v.length >0 
        ],
        // email: '',
        // erules: {
        //   required: value => !!value || 'This email field is Required.', 
        //   em: v => (v.length > 0 && /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(v) || 'Email must be valid') 
        // },
07095d4d8   Jatinder Singh   regex
88
89
        password: '',
        rules: {
c35a8dafd   Jatinder Singh   minor changes
90
          required: value => !!value || 'password is Required.',
07095d4d8   Jatinder Singh   regex
91
92
93
          min: v => (/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/).test(v) && v.length >= 8 || 'Min 8 characters upper case lower case symbol required'
          
        } 
93a68cfa1   Jatinder Singh   first commit
94
95
96
97
      };
    },
    methods: {
      login () {
e173bab21   Jatinder Singh   api
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
        var userdata = {
          "userName":this.userLogincredentials.userName,
          "password":this.userLogincredentials.password
        }
        axios.post('http://18.208.28.55:3000/v1/adminLogin',userdata)
          .then(response => {
              window.localStorage.setItem("value1", true);
            console.log("response=====>",response.data.data);
         }).catch(err => {
             console.log("err====>",err);
         })
        // this.loading = true;
        // setTimeout(() => {
        //   this.$router.push('/dashboard');
        // }, 1000);
4413a8d93   Jatinder Singh   changes
113
      }
93a68cfa1   Jatinder Singh   first commit
114
115
    }
  };
93a68cfa1   Jatinder Singh   first commit
116
117
118
119
120
121
122
123
124
125
126
127
  </script>
  
  <style scoped lang="css">
    #login{
      width: 100%;
      position: absolute;
      top: 0;
      left: 0;
      content: "";
      z-index: 0;
    }
  </style>
04e3fbc56   Jatinder Singh   minor fix
128
  <style scoped>
93a68cfa1   Jatinder Singh   first commit
129
130
131
  img{
  position:absolute;
  top:13px;
04e3fbc56   Jatinder Singh   minor fix
132
133
134
135
  left:50px;
  }
  .v-btn--large {
      padding: 0px 84px;
93a68cfa1   Jatinder Singh   first commit
136
  }
04e3fbc56   Jatinder Singh   minor fix
137
138
139
140
  #fp{
    position: absolute;
    top: 193px;
    right: 128px;
4413a8d93   Jatinder Singh   changes
141
    color: black;
04e3fbc56   Jatinder Singh   minor fix
142
  }
4413a8d93   Jatinder Singh   changes
143
144
145
  a{
  color: #696969;
  }
04e3fbc56   Jatinder Singh   minor fix
146

09f34e0c8   Jatinder Singh   notification page
147

93a68cfa1   Jatinder Singh   first commit
148
  </style>