fix:重置密码界面接通
This commit is contained in:
@@ -207,7 +207,8 @@ const local: any = {
|
|||||||
registerSuccess:'Register successfully',
|
registerSuccess:'Register successfully',
|
||||||
welcomeBack: 'Welcome back, {username} !',
|
welcomeBack: 'Welcome back, {username} !',
|
||||||
checkCode: 'Please check the verification code',
|
checkCode: 'Please check the verification code',
|
||||||
emailPlaceholder:'Please enter the email'
|
emailPlaceholder:'Please enter the email',
|
||||||
|
getCodeFailed: 'Failed to get verification code, please try again'
|
||||||
},
|
},
|
||||||
pwdLogin: {
|
pwdLogin: {
|
||||||
title: 'Password Login',
|
title: 'Password Login',
|
||||||
@@ -218,7 +219,8 @@ const local: any = {
|
|||||||
otherLoginMode: 'Other Login Mode',
|
otherLoginMode: 'Other Login Mode',
|
||||||
superAdmin: 'Super Admin',
|
superAdmin: 'Super Admin',
|
||||||
admin: 'Admin',
|
admin: 'Admin',
|
||||||
user: 'User'
|
user: 'User',
|
||||||
|
loginFailed: 'Login failed, please check your username and password'
|
||||||
},
|
},
|
||||||
codeLogin: {
|
codeLogin: {
|
||||||
title: 'Verification Code Login',
|
title: 'Verification Code Login',
|
||||||
@@ -278,8 +280,8 @@ const local: any = {
|
|||||||
newPassword: 'New Password',
|
newPassword: 'New Password',
|
||||||
passwordSameAsOld: 'New password cannot be the same as current password',
|
passwordSameAsOld: 'New password cannot be the same as current password',
|
||||||
passwordLength: 'Password must be at least 6 characters',
|
passwordLength: 'Password must be at least 6 characters',
|
||||||
byPassword: 'Reset by Password',
|
resetSuccess: 'Password reset successfully',
|
||||||
byEmail: 'Reset by Email Code'
|
resetFailed: 'Password reset failed, please try again'
|
||||||
},
|
},
|
||||||
bindWeChat: {
|
bindWeChat: {
|
||||||
title: 'Bind WeChat'
|
title: 'Bind WeChat'
|
||||||
|
|||||||
@@ -207,7 +207,8 @@ const local:any = {
|
|||||||
registerSuccess:'注册成功',
|
registerSuccess:'注册成功',
|
||||||
welcomeBack: '欢迎回来,{username} !',
|
welcomeBack: '欢迎回来,{username} !',
|
||||||
checkCode: '请输入验证码',
|
checkCode: '请输入验证码',
|
||||||
emailPlaceholder:'请输入邮箱'
|
emailPlaceholder:'请输入邮箱',
|
||||||
|
getCodeFailed: '获取验证码失败,请重试'
|
||||||
},
|
},
|
||||||
pwdLogin: {
|
pwdLogin: {
|
||||||
title: '密码登录',
|
title: '密码登录',
|
||||||
@@ -218,7 +219,8 @@ const local:any = {
|
|||||||
otherLoginMode: '其他登录方式',
|
otherLoginMode: '其他登录方式',
|
||||||
superAdmin: '超级管理员',
|
superAdmin: '超级管理员',
|
||||||
admin: '管理员',
|
admin: '管理员',
|
||||||
user: '普通用户'
|
user: '普通用户',
|
||||||
|
loginFailed: '登录失败,请检查用户名和密码'
|
||||||
},
|
},
|
||||||
codeLogin: {
|
codeLogin: {
|
||||||
title: '验证码登录',
|
title: '验证码登录',
|
||||||
@@ -279,7 +281,9 @@ const local:any = {
|
|||||||
passwordSameAsOld: '新密码不能与原密码相同',
|
passwordSameAsOld: '新密码不能与原密码相同',
|
||||||
passwordLength: '密码长度不能小于6位',
|
passwordLength: '密码长度不能小于6位',
|
||||||
byPassword: '通过原密码重置',
|
byPassword: '通过原密码重置',
|
||||||
byEmail: '通过邮箱验证码重置'
|
byEmail: '通过邮箱验证码重置',
|
||||||
|
resetSuccess: '密码重置成功',
|
||||||
|
resetFailed: '密码重置失败,请重试'
|
||||||
},
|
},
|
||||||
bindWeChat: {
|
bindWeChat: {
|
||||||
title: '绑定微信'
|
title: '绑定微信'
|
||||||
|
|||||||
@@ -190,6 +190,15 @@ export function uploadFile(file: File) {
|
|||||||
data: formData
|
data: formData
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/** Reset password */
|
||||||
|
export function resetPassword(data: { oldPassword: string; newPassword: string }) {
|
||||||
|
return request({
|
||||||
|
url: `/u/user/profile/updatePwd`,
|
||||||
|
method: 'put',
|
||||||
|
params: data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
1
src/typings/auto-imports.d.ts
vendored
1
src/typings/auto-imports.d.ts
vendored
@@ -194,6 +194,7 @@ declare global {
|
|||||||
const refThrottled: typeof import('@vueuse/core')['refThrottled']
|
const refThrottled: typeof import('@vueuse/core')['refThrottled']
|
||||||
const refWithControl: typeof import('@vueuse/core')['refWithControl']
|
const refWithControl: typeof import('@vueuse/core')['refWithControl']
|
||||||
const removeEmptyChildren: typeof import('../utils/menu')['removeEmptyChildren']
|
const removeEmptyChildren: typeof import('../utils/menu')['removeEmptyChildren']
|
||||||
|
const resetPassword: typeof import('../service/api/auth')['resetPassword']
|
||||||
const resolveComponent: typeof import('vue')['resolveComponent']
|
const resolveComponent: typeof import('vue')['resolveComponent']
|
||||||
const resolveRef: typeof import('@vueuse/core')['resolveRef']
|
const resolveRef: typeof import('@vueuse/core')['resolveRef']
|
||||||
const resolveUnref: typeof import('@vueuse/core')['resolveUnref']
|
const resolveUnref: typeof import('@vueuse/core')['resolveUnref']
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
Radio,
|
Radio,
|
||||||
} from 'ant-design-vue';
|
} from 'ant-design-vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
import { resetPassword } from '@/service/api/auth';
|
||||||
|
|
||||||
const AInputPassword = Input.Password;
|
const AInputPassword = Input.Password;
|
||||||
const ARadioGroup = Radio.Group;
|
const ARadioGroup = Radio.Group;
|
||||||
@@ -98,10 +99,23 @@ async function handleCaptcha() {
|
|||||||
async function handleSubmit() {
|
async function handleSubmit() {
|
||||||
try {
|
try {
|
||||||
await formRef.value?.validate();
|
await formRef.value?.validate();
|
||||||
//
|
|
||||||
window.$message?.success(t('common.success'));
|
if (resetType.value === 'password') {
|
||||||
|
// 通过原密码重置
|
||||||
|
await resetPassword({
|
||||||
|
oldPassword: formModel.oldPassword,
|
||||||
|
newPassword: formModel.password
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// TODO: 通过邮箱验证码重置的接口
|
||||||
|
}
|
||||||
|
|
||||||
|
window.$message?.success(t('page.login.resetPwd.resetSuccess'));
|
||||||
|
// 重置成功后返回个人信息页面
|
||||||
|
router.push('/userInfo/usercard');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Form validation failed:', error);
|
console.error('Reset password failed:', error);
|
||||||
|
window.$message?.error(t('page.login.resetPwd.resetFailed'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +137,7 @@ const handleBack = () => {
|
|||||||
|
|
||||||
<a-radio-group v-model:value="resetType" class="mb-24px">
|
<a-radio-group v-model:value="resetType" class="mb-24px">
|
||||||
<a-radio value="password">{{ t('page.login.resetPwd.byPassword') }}</a-radio>
|
<a-radio value="password">{{ t('page.login.resetPwd.byPassword') }}</a-radio>
|
||||||
<a-radio value="email">{{ t('page.login.resetPwd.byEmail') }}</a-radio>
|
<!-- <a-radio value="email">{{ t('page.login.resetPwd.byEmail') }}</a-radio>-->
|
||||||
</a-radio-group>
|
</a-radio-group>
|
||||||
|
|
||||||
<a-form
|
<a-form
|
||||||
|
|||||||
Reference in New Issue
Block a user