From 299b33e3e920c2302cfa411bed6de79a6e372995 Mon Sep 17 00:00:00 2001 From: knox Date: Sat, 13 Jul 2024 18:13:49 +0200 Subject: [PATCH] - fix error messages on password change - clear password change fields when password change was successful --- .../views/UserManagement/components/ChangePasswordForm.jsx | 7 +++++-- ui/api/resources/user.js | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ui/App/views/UserManagement/components/ChangePasswordForm.jsx b/ui/App/views/UserManagement/components/ChangePasswordForm.jsx index e792ec4..ca00c4d 100644 --- a/ui/App/views/UserManagement/components/ChangePasswordForm.jsx +++ b/ui/App/views/UserManagement/components/ChangePasswordForm.jsx @@ -7,13 +7,16 @@ import Input from "../../../components/Input"; import Error from "../../../components/Error"; const ChangePasswordForm = () => { - const {register, handleSubmit, formState: {errors}, watch} = useForm(); + const {register, handleSubmit, reset, formState: {errors}, watch} = useForm(); + + const new_password = watch("new_password"); const onSubmit = async (data) => { const res = await user.changePassword(data); if (res) { // Update successful window.flash("Password changed", "green") + reset(); } } @@ -37,7 +40,7 @@ const ChangePasswordForm = () => {