Blame view

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

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