비밀번호 재설정
This commit is contained in:
parent
f3ca41f9ad
commit
5d1f220f14
@ -44,13 +44,13 @@
|
||||
|
||||
<div class="d-flex mt-5">
|
||||
<RouterLink type="button" class="btn btn-secondary me-2 w-50" to="/login">취소</RouterLink>
|
||||
<button @click="handleSubmit" class="btn btn-primary w-50">확인</button>
|
||||
<button type="button" @click="handleSubmit" class="btn btn-primary w-50">확인</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="resetForm" class="mt-4">
|
||||
<UserFormInput
|
||||
title="비밀번호"
|
||||
title="새 비밀번호"
|
||||
name="pw"
|
||||
type="password"
|
||||
:isEssential="true"
|
||||
@ -74,13 +74,14 @@
|
||||
<span v-if="passwordcheckError" class="invalid-feedback d-block">{{ passwordcheckError }}</span>
|
||||
|
||||
<div class="d-grid gap-2 mt-5 mb-5">
|
||||
<button @click="handlePasswordReset" class="btn btn-primary">확인</button>
|
||||
<button type="button" @click="handleNewPassword" class="btn btn-primary">확인</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import $api from '@api';
|
||||
import commonApi from '@/common/commonApi';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useToastStore } from '@s/toastStore';
|
||||
@ -125,14 +126,14 @@
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await $api.post('/user/pwReset', {
|
||||
const response = await $api.post('user/pwReset', {
|
||||
id: id.value,
|
||||
birth: birth.value,
|
||||
pwhint: pwhint.value,
|
||||
pwhintRes: pwhintRes.value,
|
||||
});
|
||||
|
||||
if (response.status === 200) {
|
||||
if (response.status === 200 && response.data.data === true) {
|
||||
resetForm.value = true;
|
||||
} else {
|
||||
toastStore.onToast('일치하는 정보가 없습니다.', 'e');
|
||||
@ -150,7 +151,7 @@
|
||||
};
|
||||
|
||||
// 비밀번호 업데이트
|
||||
const handlePasswordReset = async () => {
|
||||
const handleNewPassword = async () => {
|
||||
passwordAlert.value = password.value.trim() === '';
|
||||
passwordcheckAlert.value = passwordcheck.value.trim() === '';
|
||||
|
||||
@ -158,5 +159,15 @@
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await $api.patch('user/pwNew', {
|
||||
id: id.value,
|
||||
password: password.value
|
||||
});
|
||||
|
||||
if (response.status === 200 && response.data.data === true) {
|
||||
toastStore.onToast('비밀번호가 재설정 되었습니다.', 's');
|
||||
router.push('/login');
|
||||
}
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user