diff --git a/app/resources/js/views/auth/ResetPasswordView.vue b/app/resources/js/views/auth/ResetPasswordView.vue index 3113495d..d185285c 100644 --- a/app/resources/js/views/auth/ResetPasswordView.vue +++ b/app/resources/js/views/auth/ResetPasswordView.vue @@ -37,6 +37,17 @@ const canSubmit = computed( password.value === passwordConfirmation.value, ); +/** + * Ошибка поля подтверждения: client-side проверка совпадения + + * проброс backend-ошибки `password_confirmation` если придёт с 422. + */ +const confirmationError = computed(() => { + if (passwordConfirmation.value.length > 0 && password.value !== passwordConfirmation.value) { + return ['Пароли не совпадают']; + } + return errors.value.password_confirmation ?? []; +}); + async function handleSubmit() { errors.value = {}; try { @@ -115,6 +126,7 @@ async function handleSubmit() { variant="outlined" density="comfortable" required + :error-messages="confirmationError" /> { expect(alert.exists()).toBe(true); expect(alert.text()).toContain('10 мин'); }); + + it('A4: показывает ошибку при несовпадении пароля и подтверждения', async () => { + const wrapper = await mountReset(); + const pwInputs = wrapper.findAll('input[type="password"]'); + await pwInputs[0].setValue('new-strong-pass-1234'); + await pwInputs[1].setValue('different-pass-9999'); + await wrapper.vm.$nextTick(); + expect(wrapper.text()).toContain('Пароли не совпадают'); + }); });