diff --git a/src/views/ChangePass.vue b/src/views/ChangePass.vue index f7db0dae52709611ab53e15c998958e5595e2d33..f1fced30454fab4d298b55bb813e1054b8ffcda5 100644 --- a/src/views/ChangePass.vue +++ b/src/views/ChangePass.vue @@ -13,10 +13,10 @@ <form @submit.prevent="save" autocomplete="off" id="formAdmin"> <div class="row px-5"> <div class="col"> - <Passinput id="currentPass" title="Kata Sandi Lama" v-model="current_password"/> - <Passinput id="newPass" title="Kata Sandi Baru" v-model="new_password"/> - <Passinput id="confirmNewPass" title="Konfirmasi Kata Sandi Baru" v-model="new_password_confirmation"/> - + <Passinput id="currentPass" title="Kata Sandi Lama*" v-model="current_password"/> + <Passinput id="newPass" title="Kata Sandi Baru*" v-model="new_password"/> + <Passinput id="confirmNewPass" title="Konfirmasi Kata Sandi Baru*" v-model="new_password_confirmation"/> + <p class="mb-2" style="color:#6992b4; font-size:small">*minimal terdiri dari 8 karakter</p> <button type="submit" class="btn-blue p-1" >Simpan Kata Sandi</button> </div> </div> @@ -69,11 +69,17 @@ export default { new_password: this.new_password, new_password_confirmation: this.new_password_confirmation, } - if (this.current_password != "" && this.new_password != "" && this.new_password_confirmation != ""){ + + if (this.new_password != this.new_password_confirmation){ + alert("Konfirmasi kata sandi baru salah!") + this.new_password_confirmation="" + } + else if (this.current_password != "" && this.new_password != "" && this.new_password_confirmation != ""){ data.current_password = this.current_password data.new_password = this.new_password data.new_password_confirmation = this.new_password_confirmation - + + HTTP.put(`users/change-password`, data, { headers: { 'Content-Type': 'application/json' @@ -81,6 +87,7 @@ export default { }).then((res)=>{ if (res.status == 200){ alert("Kata sandi berhasil diganti") + document.getElementById("formAdmin").reset(); } }).catch(() => alert("Gagal mengganti kata sandi")) }