Blame view
src/pages/Authentication/changepassword.vue
3.75 KB
93a68cfa1
|
1 2 |
<template> <v-app id="login"> |
5f2dd99ed
|
3 |
<app-toolbar class="app--toolbar"></app-toolbar> |
93a68cfa1
|
4 |
<v-container fluid fill-height> |
04e3fbc56
|
5 |
<v-layout> |
603a06702
|
6 7 |
<v-flex xs12 sm8 md8 lg5 offset-sm2 offset-lg3 class="mt-5"> <v-toolbar class="fixcolors mt-5" dark> |
93a68cfa1
|
8 |
<v-spacer></v-spacer> |
2b0e316ee
|
9 |
<v-toolbar-title>Technology Succes</v-toolbar-title> |
93a68cfa1
|
10 11 12 |
<v-spacer></v-spacer> </v-toolbar> |
04e3fbc56
|
13 |
<v-card class="elevation-1 pa-3" id="form"> |
93a68cfa1
|
14 |
<v-card-text> |
f42c1d9c9
|
15 |
<v-flex xs12 sm8 md8 lg8 offset-sm2> |
04e3fbc56
|
16 17 |
<v-form class="mt-3" > <v-text-field |
e3e2a04c6
|
18 |
:rules="[rules.required]" |
e3e2a04c6
|
19 20 |
v-model="adminChangePasswordcredentials.oldPassword" label="Old Password"> |
04e3fbc56
|
21 22 |
</v-text-field> <v-text-field |
e9818ce3a
|
23 |
v-model="adminChangePasswordcredentials.newPassword" |
e3e2a04c6
|
24 |
:rules="[rules.required]" |
250d1e021
|
25 |
|
04e3fbc56
|
26 27 |
label="New Password" ></v-text-field> |
04e3fbc56
|
28 |
</v-form></v-flex> |
93a68cfa1
|
29 30 |
</v-card-text> <v-card-actions> |
04e3fbc56
|
31 |
|
f42c1d9c9
|
32 |
<v-flex text-xs-center> |
93a68cfa1
|
33 34 35 36 |
<v-btn class="mt-3" round color="black" dark large |
04e3fbc56
|
37 |
:loading="loading" |
93a68cfa1
|
38 39 |
@click="reset">Reset Password</v-btn></v-flex> </v-card-actions> |
03dcbf0c1
|
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
|
50 51 52 53 |
</v-card> </v-flex> </v-layout> </v-container> |
93a68cfa1
|
54 55 56 |
</v-app> </template> <script> |
03dcbf0c1
|
57 |
import http from '@/Services/http.js'; |
1c1942362
|
58 |
import AppToolbar from '@/components/pageHeader/AppToolbar'; |
03dcbf0c1
|
59 |
|
93a68cfa1
|
60 |
export default { |
5f2dd99ed
|
61 62 63 |
components: { AppToolbar, }, |
93a68cfa1
|
64 65 |
data () { return { |
03dcbf0c1
|
66 67 68 69 70 71 |
snackbar: false, y: 'top', x: 'right', mode: '', timeout: 4000, text: '', |
b34ed827a
|
72 |
adminChangePasswordcredentials: {}, |
04e3fbc56
|
73 74 75 |
e1: true, e2: true, e3: true, |
93a68cfa1
|
76 77 |
loading: false, valid: false, |
04e3fbc56
|
78 |
text: 'Password Changed', |
e173bab21
|
79 |
currentPassword: '', |
e9818ce3a
|
80 81 |
newPassword: '', confirmPassword: '', |
04e3fbc56
|
82 83 |
rules: { required: value => !!value || 'This password field is Required.', |
e3e2a04c6
|
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
|
85 |
}, |
93a68cfa1
|
86 87 88 89 |
}; }, methods: { reset () { |
03dcbf0c1
|
90 |
var token = this.$store.state.token; |
e173bab21
|
91 |
var userdata = { |
e3e2a04c6
|
92 |
"oldPassword":this.adminChangePasswordcredentials.oldPassword, |
e173bab21
|
93 |
"newPassword":this.adminChangePasswordcredentials.newPassword, |
e173bab21
|
94 |
} |
e3e2a04c6
|
95 |
http().put('/schoolChangePassword',userdata,{headers: { Authorization: 'Bearer '+ token }}) |
e173bab21
|
96 |
.then(response => { |
03dcbf0c1
|
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
|
105 |
}).catch(err => { |
03dcbf0c1
|
106 107 108 109 110 |
// console.log("err====>",err); this.text="User Not Found or Incorrect currentPassword" this.snackbar= true; this.loading = false; }) |
93a68cfa1
|
111 |
} |
03dcbf0c1
|
112 113 114 115 |
}, computed:{ color(){ return this.loading ? 'success' : 'error' |
1c1942362
|
116 117 |
} } |
93a68cfa1
|
118 119 |
}; </script> |
04e3fbc56
|
120 |
<style scoped> |
93a68cfa1
|
121 122 123 |
img{ position:absolute; top:13px; |
04e3fbc56
|
124 |
left:50px; |
93a68cfa1
|
125 |
} |
04e3fbc56
|
126 127 128 |
.v-btn--large { padding: 0px 74px; } |
f42c1d9c9
|
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
|
137 |
</style> |