diff --git a/client/src/views/SettingsView.vue b/client/src/views/SettingsView.vue index 0445acff..62211b75 100644 --- a/client/src/views/SettingsView.vue +++ b/client/src/views/SettingsView.vue @@ -9,18 +9,35 @@ + + + + @@ -49,8 +66,12 @@ import { useAsyncState } from '@vueuse/core' export default defineComponent({ setup() { const form = ref() + const show_old = ref(false) + const show_new = ref(false) + const show_confirm = ref(false) const old_password = ref('') const new_password = ref('') + const confirm_password = ref('') const { execute, isLoading } = useAsyncState( async () => { @@ -63,13 +84,25 @@ export default defineComponent({ { immediate: false } ) + const confirmPassword = () => new_password.value == confirm_password.value || "Passwords should match." + + const validateForm = () => { + form.value?.validate() + } + return { form, + show_old, + show_new, old_password, new_password, + show_confirm, + confirm_password, passwordRules, isLoading, - execute + execute, + confirmPassword, + validateForm } } }) diff --git a/server/cshr/views/auth.py b/server/cshr/views/auth.py index cf02d724..bc01630a 100644 --- a/server/cshr/views/auth.py +++ b/server/cshr/views/auth.py @@ -88,8 +88,8 @@ def put(self, request: Request) -> Response: request.user.password = new_password request.user.save() return CustomResponse.success(message="Success updated password") - return CustomResponse.unauthorized() + return CustomResponse.unauthorized(message="Incorrect password. Please ensure that the password provided is accurate.") return CustomResponse.bad_request( - message="Please make sure that you entered a valid data", + message="Please make sure that you entered a valid data.", error=serializer.errors, )