Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | 1x | <template>
<div class="container-fluid mt-4">
<h2 class="text-left mt-3">
Update Password
</h2>
<b-alert :show="loading" variant="info">Loading...</b-alert>
<b-row>
<b-card
class="d-flex justify-content-center col-sm-3 "
style="margin-left : 40%"
>
<form @submit.prevent="savePost">
<b-form-group label="New Password">
<b-form-input v-model="user.password"></b-form-input>
</b-form-group>
<b-form-group label="Reenter Password">
<b-form-input v-model="testpassword"></b-form-input>
</b-form-group>
<br />
<span style="color:red">{{message}}</span>
<br/>
<div>
<b-btn type="submit" id="submit" variant="success">Save Company</b-btn>
</div>
</form>
</b-card>
</b-row>
<br />
</div>
</template>
<script>
//import api from '@/api'
export default {
name: "updatePassword",
data() {
return {
loading: false,
user: {},
message:"",
testpassword:""
};
},
async created() {},
async mounted() {},
methods: {
/**
* @vuese
* This method updates the password
*/
async savePost() {
let userId = this.$route.params.userId;
this.user.userId = userId;
console.log(this.user);
console.log(this.user.password,this.testpassword);
if(this.user.password == this.testpassword){
await this.$axios.post("/updatePassword", this.user);
this.message="updated successfully";
this.$router.push({ name: "login" });
}else{
this.message="password should match"
}
console.log(this.user);
},
/**
* @vuese
* This method destroys the token and logs out of the application
*/
logout() {
this.$store.dispatch("destroyToken").then(() => {
this.$router.push({ name: "login" });
});
},
},
};
</script>
|