feat(auth): A4 — ResetPassword ошибка несовпадения паролей (Sprint 5A)
This commit is contained in:
@@ -37,6 +37,17 @@ const canSubmit = computed(
|
||||
password.value === passwordConfirmation.value,
|
||||
);
|
||||
|
||||
/**
|
||||
* Ошибка поля подтверждения: client-side проверка совпадения +
|
||||
* проброс backend-ошибки `password_confirmation` если придёт с 422.
|
||||
*/
|
||||
const confirmationError = computed<string[]>(() => {
|
||||
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"
|
||||
/>
|
||||
|
||||
<v-btn
|
||||
|
||||
@@ -103,4 +103,13 @@ describe('ResetPasswordView.vue', () => {
|
||||
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('Пароли не совпадают');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user