Blame view
src/pages/changepassword.vue
4.18 KB
93a68cfa1
|
1 2 |
<template> <v-app id="login"> |
04e3fbc56
|
3 |
<!-- <v-toolbar color="grey lighten"> |
93a68cfa1
|
4 5 6 |
<v-toolbar-items> <img src="/static/ana@2x.png" height="36" alt="ana"> </v-toolbar-items> |
04e3fbc56
|
7 8 |
</v-toolbar>--> <!-- <v-content> --> |
93a68cfa1
|
9 |
<v-container fluid fill-height> |
04e3fbc56
|
10 |
<v-layout> |
f42c1d9c9
|
11 |
<v-flex xs12 sm8 md8 lg5 offset-sm2 offset-lg3> |
93a68cfa1
|
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
|
18 |
<v-card class="elevation-1 pa-3" id="form"> |
93a68cfa1
|
19 |
<v-card-text> |
f42c1d9c9
|
20 |
<v-flex xs12 sm8 md8 lg8 offset-sm2> |
04e3fbc56
|
21 22 23 |
<v-form class="mt-3" > <v-text-field :rules="[rules.required, rules.min]" |
250d1e021
|
24 |
|
e173bab21
|
25 |
v-model="adminChangePasswordcredentials.currentPassword" |
04e3fbc56
|
26 27 28 |
label="Current Password"> </v-text-field> <v-text-field |
e9818ce3a
|
29 |
v-model="adminChangePasswordcredentials.newPassword" |
04e3fbc56
|
30 |
:rules="[rules.required, rules.min]" |
250d1e021
|
31 |
|
04e3fbc56
|
32 33 34 |
label="New Password" ></v-text-field> <v-text-field |
e9818ce3a
|
35 36 |
v-model="adminChangePasswordcredentials.confirmPassword" :rules="[rules.required, rules.min]" |
04e3fbc56
|
37 38 39 |
label="Confirm Password" ></v-text-field> </v-form></v-flex> |
93a68cfa1
|
40 41 |
</v-card-text> <v-card-actions> |
04e3fbc56
|
42 |
|
f42c1d9c9
|
43 |
<v-flex text-xs-center> |
93a68cfa1
|
44 45 46 47 |
<v-btn class="mt-3" round color="black" dark large |
04e3fbc56
|
48 |
:loading="loading" |
93a68cfa1
|
49 50 |
@click="reset">Reset Password</v-btn></v-flex> </v-card-actions> |
03dcbf0c1
|
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
|
61 62 63 64 |
</v-card> </v-flex> </v-layout> </v-container> |
04e3fbc56
|
65 66 |
<!-- </v-content> <v-footer class="pa-4" color="grey darken-2"> |
93a68cfa1
|
67 |
|
04e3fbc56
|
68 |
</v-footer> --> |
93a68cfa1
|
69 70 71 |
</v-app> </template> <script> |
03dcbf0c1
|
72 |
import http from '@/Services/http.js'; |
93a68cfa1
|
73 74 75 |
export default { data () { return { |
03dcbf0c1
|
76 77 78 79 80 81 |
snackbar: false, y: 'top', x: 'right', mode: '', timeout: 4000, text: '', |
b34ed827a
|
82 |
adminChangePasswordcredentials: {}, |
04e3fbc56
|
83 84 85 |
e1: true, e2: true, e3: true, |
93a68cfa1
|
86 87 |
loading: false, valid: false, |
04e3fbc56
|
88 |
text: 'Password Changed', |
e173bab21
|
89 |
currentPassword: '', |
e9818ce3a
|
90 91 |
newPassword: '', confirmPassword: '', |
04e3fbc56
|
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
|
96 97 98 99 |
}; }, methods: { reset () { |
03dcbf0c1
|
100 |
var token = this.$store.state.token; |
e173bab21
|
101 102 103 104 105 |
var userdata = { "currentPassword":this.adminChangePasswordcredentials.currentPassword, "newPassword":this.adminChangePasswordcredentials.newPassword, "confirmPassword":this.adminChangePasswordcredentials.confirmPassword } |
03dcbf0c1
|
106 |
http().post('/adminChangePassword',userdata,{headers: {Authorization: 'Bearer '+token}}) |
e173bab21
|
107 |
.then(response => { |
03dcbf0c1
|
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
|
116 |
}).catch(err => { |
03dcbf0c1
|
117 118 119 120 121 |
// console.log("err====>",err); this.text="User Not Found or Incorrect currentPassword" this.snackbar= true; this.loading = false; }) |
93a68cfa1
|
122 |
} |
03dcbf0c1
|
123 124 125 126 127 128 |
}, computed:{ color(){ return this.loading ? 'success' : 'error' } } |
93a68cfa1
|
129 130 |
}; </script> |
04e3fbc56
|
131 |
<style scoped> |
93a68cfa1
|
132 133 134 |
img{ position:absolute; top:13px; |
04e3fbc56
|
135 |
left:50px; |
93a68cfa1
|
136 |
} |
04e3fbc56
|
137 138 139 |
.v-btn--large { padding: 0px 74px; } |
f42c1d9c9
|
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
|
148 |
</style> |