Blame view

src/pages/changepassword.vue 4.18 KB
93a68cfa1   Jatinder Singh   first commit
1
2
  <template>
    <v-app id="login">
04e3fbc56   Jatinder Singh   minor fix
3
      <!-- <v-toolbar color="grey lighten">
93a68cfa1   Jatinder Singh   first commit
4
5
6
        <v-toolbar-items>
      <img src="/static/ana@2x.png" height="36" alt="ana">
      </v-toolbar-items>
04e3fbc56   Jatinder Singh   minor fix
7
8
    </v-toolbar>-->
      <!-- <v-content>  -->
93a68cfa1   Jatinder Singh   first commit
9
        <v-container fluid fill-height>
04e3fbc56   Jatinder Singh   minor fix
10
          <v-layout>
f42c1d9c9   Neeraj Sharma   something change ...
11
            <v-flex xs12 sm8 md8 lg5 offset-sm2 offset-lg3>
93a68cfa1   Jatinder Singh   first commit
12
13
14
15
16
17
            <v-toolbar color="black" dark>
            <v-spacer></v-spacer>
            <v-toolbar-title>Change Password</v-toolbar-title>
            <v-spacer></v-spacer>
            
            </v-toolbar>
04e3fbc56   Jatinder Singh   minor fix
18
              <v-card class="elevation-1 pa-3" id="form">
93a68cfa1   Jatinder Singh   first commit
19
                <v-card-text>
f42c1d9c9   Neeraj Sharma   something change ...
20
              <v-flex xs12 sm8 md8 lg8 offset-sm2>  
04e3fbc56   Jatinder Singh   minor fix
21
22
23
              <v-form class="mt-3" >
              <v-text-field 
               :rules="[rules.required, rules.min]"
250d1e021   Jatinder Singh   datatable change
24
             
e173bab21   Jatinder Singh   api
25
               v-model="adminChangePasswordcredentials.currentPassword"
04e3fbc56   Jatinder Singh   minor fix
26
27
28
               label="Current Password">
              </v-text-field>
              <v-text-field
e9818ce3a   Jatinder Singh   api
29
              v-model="adminChangePasswordcredentials.newPassword"
04e3fbc56   Jatinder Singh   minor fix
30
              :rules="[rules.required, rules.min]"
250d1e021   Jatinder Singh   datatable change
31
             
04e3fbc56   Jatinder Singh   minor fix
32
33
34
              label="New Password"
              ></v-text-field>
              <v-text-field
e9818ce3a   Jatinder Singh   api
35
36
              v-model="adminChangePasswordcredentials.confirmPassword"
              :rules="[rules.required, rules.min]"
04e3fbc56   Jatinder Singh   minor fix
37
38
39
               label="Confirm Password"
               ></v-text-field>
              </v-form></v-flex>
93a68cfa1   Jatinder Singh   first commit
40
41
                </v-card-text>
            <v-card-actions>
04e3fbc56   Jatinder Singh   minor fix
42
              
f42c1d9c9   Neeraj Sharma   something change ...
43
            <v-flex text-xs-center>
93a68cfa1   Jatinder Singh   first commit
44
45
46
47
                  <v-btn class="mt-3" 
                  round 
                  color="black" 
                  dark large
04e3fbc56   Jatinder Singh   minor fix
48
                  :loading="loading"
93a68cfa1   Jatinder Singh   first commit
49
50
                  @click="reset">Reset Password</v-btn></v-flex>
                  </v-card-actions>
03dcbf0c1   Neeraj Sharma   fix all api and r...
51
52
53
54
55
56
57
58
59
60
                 <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
61
62
63
64
              </v-card>
            </v-flex>
          </v-layout>
        </v-container>
04e3fbc56   Jatinder Singh   minor fix
65
66
      <!-- </v-content>
       <v-footer class="pa-4" color="grey darken-2">
93a68cfa1   Jatinder Singh   first commit
67
    
04e3fbc56   Jatinder Singh   minor fix
68
    </v-footer> -->
93a68cfa1   Jatinder Singh   first commit
69
70
71
    </v-app>
  </template>
  <script>
03dcbf0c1   Neeraj Sharma   fix all api and r...
72
  import http from '@/Services/http.js';
93a68cfa1   Jatinder Singh   first commit
73
74
75
  export default {
    data () {
      return {
03dcbf0c1   Neeraj Sharma   fix all api and r...
76
77
78
79
80
81
        snackbar: false,
        y: 'top',
        x: 'right',
        mode: '',
        timeout: 4000,
        text: '',
b34ed827a   Jatinder Singh   changes
82
        adminChangePasswordcredentials: {},
04e3fbc56   Jatinder Singh   minor fix
83
84
85
        e1: true,
        e2: true,
        e3: true,
93a68cfa1   Jatinder Singh   first commit
86
87
        loading: false,
        valid: false,
04e3fbc56   Jatinder Singh   minor fix
88
        text: 'Password Changed',
e173bab21   Jatinder Singh   api
89
        currentPassword: '',
e9818ce3a   Jatinder Singh   api
90
91
        newPassword: '',
        confirmPassword: '',
04e3fbc56   Jatinder Singh   minor fix
92
93
94
95
        rules: {
          required: value => !!value || 'This password field is Required.',
          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
96
97
98
99
      };
    },
    methods: {
      reset () {
03dcbf0c1   Neeraj Sharma   fix all api and r...
100
        var token = this.$store.state.token;
e173bab21   Jatinder Singh   api
101
102
103
104
105
        var userdata = {
          "currentPassword":this.adminChangePasswordcredentials.currentPassword,
          "newPassword":this.adminChangePasswordcredentials.newPassword,
          "confirmPassword":this.adminChangePasswordcredentials.confirmPassword
        }
03dcbf0c1   Neeraj Sharma   fix all api and r...
106
        http().post('/adminChangePassword',userdata,{headers: {Authorization: 'Bearer '+token}})
e173bab21   Jatinder Singh   api
107
          .then(response => {
03dcbf0c1   Neeraj Sharma   fix all api and r...
108
109
110
111
112
113
114
115
            this.loading = true;
             if(this.snackbar=true){
                this.text= "Successfully changed password !!"              
                console.log("snackbar",response.data.message)
              }
              setTimeout(() => {
              this.$router.push('/dashboard');
          }, 2000);
e173bab21   Jatinder Singh   api
116
         }).catch(err => {
03dcbf0c1   Neeraj Sharma   fix all api and r...
117
118
119
120
121
            // console.log("err====>",err);
             this.text="User Not Found or Incorrect currentPassword"
             this.snackbar= true;
             this.loading = false;
         })    
93a68cfa1   Jatinder Singh   first commit
122
      }
03dcbf0c1   Neeraj Sharma   fix all api and r...
123
124
125
126
127
128
    },
    computed:{
    color(){
      return this.loading ? 'success' : 'error'
  }
  }
93a68cfa1   Jatinder Singh   first commit
129
130
  };
  </script>
04e3fbc56   Jatinder Singh   minor fix
131
  <style scoped>
93a68cfa1   Jatinder Singh   first commit
132
133
134
  img{
  position:absolute;
  top:13px;
04e3fbc56   Jatinder Singh   minor fix
135
  left:50px;
93a68cfa1   Jatinder Singh   first commit
136
  }
04e3fbc56   Jatinder Singh   minor fix
137
138
139
  .v-btn--large {
      padding: 0px 74px;
  }
f42c1d9c9   Neeraj Sharma   something change ...
140
141
142
143
144
145
146
147
  @media screen and (max-width: 769px){
  .v-btn--large {
      font-size: 14px;
      height: 44px;
      padding: 0 32px;
  
  }
  }
04e3fbc56   Jatinder Singh   minor fix
148
  </style>