From 8d088374cdcb2af1ba570c27c2396bb1c715dfec Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 22 Apr 2022 14:20:12 +0800 Subject: [PATCH] fix: change password logic using new api Signed-off-by: Wing-Kam Wong --- packages/nc-gui/pages/user/settings/index.vue | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/nc-gui/pages/user/settings/index.vue b/packages/nc-gui/pages/user/settings/index.vue index 9e1d7f82d8..3949a22d10 100644 --- a/packages/nc-gui/pages/user/settings/index.vue +++ b/packages/nc-gui/pages/user/settings/index.vue @@ -220,14 +220,20 @@ export default { async resetUserPassword(e) { e.preventDefault() if (this.$refs.formType[0].validate()) { - // console.log('passworDetails',this.passwordDetails); - const err = await this.$store.dispatch('users/ActPostPasswordChange', this.passwordDetails) - if (err) { - this.formUtil.formErr = true - this.formUtil.formErrMsg = err.data.msg - } else { + try { + await this.$api.auth.passwordChange( + { + currentPassword: this.passwordDetails.currentPassword, + newPassword: this.passwordDetails.newPassword + } + ) this.$toast.success('Password changed successfully.').goAway(3000) this.$refs.formType[0].reset() + } catch (e) { + this.$toast + .error(await this._extractSdkResponseErrorMsg(e)) + .goAway(3000); + return; } } }, @@ -251,6 +257,7 @@ export default { * * @author Naveen MR * @author Pranav C Balan + * @author Wing-Kam Wong * * @license GNU AGPL version 3 or any later version *