Blame view

src/pages/changepassword.vue 3.91 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>
5f2dd99ed   Neeraj Sharma   add full name in ...
7
    </v-toolbar> -->
04e3fbc56   Jatinder Singh   minor fix
8
      <!-- <v-content>  -->
5f2dd99ed   Neeraj Sharma   add full name in ...
9
      <app-toolbar class="app--toolbar"></app-toolbar> 
93a68cfa1   Jatinder Singh   first commit
10
        <v-container fluid fill-height>
04e3fbc56   Jatinder Singh   minor fix
11
          <v-layout>
f42c1d9c9   Neeraj Sharma   something change ...
12
            <v-flex xs12 sm8 md8 lg5 offset-sm2 offset-lg3>
93a68cfa1   Jatinder Singh   first commit
13
14
15
16
17
18
            <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
19
              <v-card class="elevation-1 pa-3" id="form">
93a68cfa1   Jatinder Singh   first commit
20
                <v-card-text>
f42c1d9c9   Neeraj Sharma   something change ...
21
              <v-flex xs12 sm8 md8 lg8 offset-sm2>  
04e3fbc56   Jatinder Singh   minor fix
22
23
              <v-form class="mt-3" >
              <v-text-field 
e3e2a04c6   Neeraj Sharma   first commit
24
               :rules="[rules.required]"
250d1e021   Jatinder Singh   datatable change
25
             
e3e2a04c6   Neeraj Sharma   first commit
26
27
               v-model="adminChangePasswordcredentials.oldPassword"
               label="Old Password">
04e3fbc56   Jatinder Singh   minor fix
28
29
              </v-text-field>
              <v-text-field
e9818ce3a   Jatinder Singh   api
30
              v-model="adminChangePasswordcredentials.newPassword"
e3e2a04c6   Neeraj Sharma   first commit
31
              :rules="[rules.required]"
250d1e021   Jatinder Singh   datatable change
32
             
04e3fbc56   Jatinder Singh   minor fix
33
34
              label="New Password"
              ></v-text-field>
04e3fbc56   Jatinder Singh   minor fix
35
              </v-form></v-flex>
93a68cfa1   Jatinder Singh   first commit
36
37
                </v-card-text>
            <v-card-actions>
04e3fbc56   Jatinder Singh   minor fix
38
              
f42c1d9c9   Neeraj Sharma   something change ...
39
            <v-flex text-xs-center>
93a68cfa1   Jatinder Singh   first commit
40
41
42
43
                  <v-btn class="mt-3" 
                  round 
                  color="black" 
                  dark large
04e3fbc56   Jatinder Singh   minor fix
44
                  :loading="loading"
93a68cfa1   Jatinder Singh   first commit
45
46
                  @click="reset">Reset Password</v-btn></v-flex>
                  </v-card-actions>
03dcbf0c1   Neeraj Sharma   fix all api and r...
47
48
49
50
51
52
53
54
55
56
                 <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
57
58
59
60
              </v-card>
            </v-flex>
          </v-layout>
        </v-container>
93a68cfa1   Jatinder Singh   first commit
61
62
63
    </v-app>
  </template>
  <script>
03dcbf0c1   Neeraj Sharma   fix all api and r...
64
  import http from '@/Services/http.js';
5f2dd99ed   Neeraj Sharma   add full name in ...
65
  import AppToolbar from '@/components/AppToolbar';
03dcbf0c1   Neeraj Sharma   fix all api and r...
66

93a68cfa1   Jatinder Singh   first commit
67
  export default {
5f2dd99ed   Neeraj Sharma   add full name in ...
68
69
70
    components: {
      AppToolbar,
    },
93a68cfa1   Jatinder Singh   first commit
71
72
    data () {
      return {
03dcbf0c1   Neeraj Sharma   fix all api and r...
73
74
75
76
77
78
        snackbar: false,
        y: 'top',
        x: 'right',
        mode: '',
        timeout: 4000,
        text: '',
b34ed827a   Jatinder Singh   changes
79
        adminChangePasswordcredentials: {},
04e3fbc56   Jatinder Singh   minor fix
80
81
82
        e1: true,
        e2: true,
        e3: true,
93a68cfa1   Jatinder Singh   first commit
83
84
        loading: false,
        valid: false,
04e3fbc56   Jatinder Singh   minor fix
85
        text: 'Password Changed',
e173bab21   Jatinder Singh   api
86
        currentPassword: '',
e9818ce3a   Jatinder Singh   api
87
88
        newPassword: '',
        confirmPassword: '',
04e3fbc56   Jatinder Singh   minor fix
89
90
        rules: {
          required: value => !!value || 'This password field is Required.',
e3e2a04c6   Neeraj Sharma   first commit
91
          // min: v => (/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/).test(v) && v.length >= 8 || 'Min 8 characters upper case lower case symbol required'
04e3fbc56   Jatinder Singh   minor fix
92
        },
93a68cfa1   Jatinder Singh   first commit
93
94
95
96
      };
    },
    methods: {
      reset () {
03dcbf0c1   Neeraj Sharma   fix all api and r...
97
        var token = this.$store.state.token;
e173bab21   Jatinder Singh   api
98
        var userdata = {
e3e2a04c6   Neeraj Sharma   first commit
99
          "oldPassword":this.adminChangePasswordcredentials.oldPassword,
e173bab21   Jatinder Singh   api
100
          "newPassword":this.adminChangePasswordcredentials.newPassword,
e173bab21   Jatinder Singh   api
101
        }
e3e2a04c6   Neeraj Sharma   first commit
102
        http().put('/schoolChangePassword',userdata,{headers: { Authorization: 'Bearer '+ token }})
e173bab21   Jatinder Singh   api
103
          .then(response => {
03dcbf0c1   Neeraj Sharma   fix all api and r...
104
105
106
107
108
109
110
111
            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
112
         }).catch(err => {
03dcbf0c1   Neeraj Sharma   fix all api and r...
113
114
115
116
117
            // console.log("err====>",err);
             this.text="User Not Found or Incorrect currentPassword"
             this.snackbar= true;
             this.loading = false;
         })    
93a68cfa1   Jatinder Singh   first commit
118
      }
03dcbf0c1   Neeraj Sharma   fix all api and r...
119
120
121
122
123
124
    },
    computed:{
    color(){
      return this.loading ? 'success' : 'error'
  }
  }
93a68cfa1   Jatinder Singh   first commit
125
126
  };
  </script>
04e3fbc56   Jatinder Singh   minor fix
127
  <style scoped>
93a68cfa1   Jatinder Singh   first commit
128
129
130
  img{
  position:absolute;
  top:13px;
04e3fbc56   Jatinder Singh   minor fix
131
  left:50px;
93a68cfa1   Jatinder Singh   first commit
132
  }
04e3fbc56   Jatinder Singh   minor fix
133
134
135
  .v-btn--large {
      padding: 0px 74px;
  }
f42c1d9c9   Neeraj Sharma   something change ...
136
137
138
139
140
141
142
143
  @media screen and (max-width: 769px){
  .v-btn--large {
      font-size: 14px;
      height: 44px;
      padding: 0 32px;
  
  }
  }
04e3fbc56   Jatinder Singh   minor fix
144
  </style>