Commit 2627d3e2 authored by youjie's avatar youjie

重置密码

parent 8fe15180
......@@ -190,6 +190,13 @@ export default {
return: '返回',
oldPassword: '旧密码',
placeholderNewPassword: '请输入新密码',
phoneCaptcha: '手机验证码',
wechat: '微信',
accountPassword: '账号密码',
unBindSuccess: '解绑成功',
unBindError: '解绑失败',
nextStepSetPassword: '下一步设置密码',
returnStep: '返回上一步',
},
// HTTP 错误状态码
httpError: {
......
......@@ -58,12 +58,17 @@ const router = createRouter({
{
path: '/resetPassword',
meta: { title: "page.resetPassword" },
component: () => import ('../views/personalCenter/resetPassword.vue')
component: () => import ('../views/personalCenter/accountCenter/resetPassword.vue')
},
{
path: '/editEmail/:forward?',
meta: { title: "page.editEmail" },
component: () => import ('../views/personalCenter/editEmail.vue')
component: () => import ('../views/personalCenter/accountCenter/editEmail.vue')
},
{
path: '/perForgePassword/:email?',
meta: { title: "page.editEmail" },
component: () => import ('../views/personalCenter/accountCenter/perForgePassword.vue')
},
]
},
......
......@@ -246,8 +246,6 @@ export interface ResetPasswordDto {
* 更新密码请求参数
*/
export interface NewPasswordResponseDto {
/** 租户ID */
tenantId: string
/** 旧密码 */
oldPassword: string
/** 新密码 */
......@@ -431,9 +429,9 @@ class UserService {
* @param tenantId 租户ID
* @returns
*/
static async wechatThirdConfigAsync(tenantId: string,providerType: number,token: string): Promise<HttpResponse> {
static async wechatThirdConfigAsync(tenantId: string,provider: number,token: string): Promise<HttpResponse> {
const data = {
providerType
provider
}
// OtaRequest 的响应拦截器会返回 response.data
const response = await OtaRequest.get(
......@@ -600,13 +598,17 @@ class UserService {
newPassword: string,
): Promise<HttpResponse> {
const data: NewPasswordResponseDto = {
tenantId,
oldPassword,
newPassword,
}
const response = await OtaRequest.post(
'/account/password',
data
'/member-auth/password',
data,
{
headers: tenantId ? {
'__tenant': tenantId
} : {}
}
)
return response as unknown as HttpResponse
}
......@@ -650,13 +652,13 @@ class UserService {
/**
* 解绑外部登录账号
* @param tenantId 租户ID(可选)
* @param ProviderType 外部id
* @param provider 外部id
*/
static async externalunbindBind(tenantId: string,ProviderType:string): Promise<HttpResponse> {
static async externalunbindBind(tenantId: string,provider:string): Promise<HttpResponse> {
const data = {
ProviderType
provider
}
const response = await OtaRequest.get(
const response = await OtaRequest.post(
'/member-auth/external-unbind-bind',
data,
{
......
......@@ -243,9 +243,9 @@ export const useUserStore = defineStore('user', {
* 获取微信appid
* @param tenantId 租户ID
*/
async getUserWechatAppIdAsync(tenantId: string,providerType: number): Promise<UserLoginResult> {
async getUserWechatAppIdAsync(tenantId: string,provider: number): Promise<UserLoginResult> {
try {
const response = await UserService.wechatThirdConfigAsync(tenantId,providerType,this.token)
const response = await UserService.wechatThirdConfigAsync(tenantId,provider,this.token)
return {
status: 'SUCCESS',
verify: false,
......
import i18n from '@/i18n'
const ProviderTypeEnum = Object.freeze({
PASSWORD: {
value: 'Password',
desc: i18n.global.t('personal.accountPassword'),
icon: '',
color: ''
},
GOOGLE: {
value: 'Google',
desc: 'Google',
icon: '',
color: ''
},
WECHAT: {
value: 'WeChat',
desc: i18n.global.t('personal.wechat'),
icon: '',
color: ''
},
LINE: {
value: 'Line',
desc: 'Line',
icon: '',
color: ''
},
PHONE: {
value: 'PhoneCaptcha',
desc: i18n.global.t('personal.phoneCaptcha'),
icon: '',
color: ''
},
QQ: {
value: 'QQ',
desc: 'QQ',
icon: '',
color: ''
},
GITEE: {
value: 'Gitee',
desc: 'Gitee',
icon: '',
color: ''
},
FACEBOOK: {
value: 'Facebook',
desc: 'Facebook',
icon: '',
color: ''
}
})
export default ProviderTypeEnum
\ No newline at end of file
......@@ -33,7 +33,6 @@
size="large"
:placeholder="t('login.verifyCodeRequired')"
:maxLength="6"
@input="handleCodeInput"
>
<template #suffix>
<a-divider direction="vertical" class="text-[16px] text-[#EEEFEB]"></a-divider>
......@@ -320,56 +319,6 @@ const handleSendCode = async () => {
}
}
// 处理验证码输入
const handleCodeInput = () => {
return
// 重置验证状态
codeValidateStatus.value = ''
codeValidateMessage.value = ''
// 当输入6位时自动验证
if (formData.code.length === 6) {
verifyCode()
}
}
// 验证验证码(在用户输入完6位后自动验证)
const verifyCode = async () => {
if (!formData.code || formData.code.length !== 6) {
return
}
try {
const result = await UserService.verifyEmailCodeAsync(
formData.email,
formData.code,
formData.tenantId || 'default',
formData.scene || 'ResetPassword'
)
if (result.isValid) {
codeValidateStatus.value = 'success'
codeValidateMessage.value = t('login.codeVerified')
emailVerified.value = true
verificationToken.value = result.temporaryToken || ''
lastVerifiedEmail.value = formData.email
formData.temporaryToken = result.temporaryToken || ''
Message.success(t('login.codeVerified'))
} else {
codeValidateStatus.value = 'error'
codeValidateMessage.value = result.message || t('login.codeInvalid')
emailVerified.value = false
verificationToken.value = ''
}
} catch (error: any) {
console.error('验证码验证失败:', error)
codeValidateStatus.value = 'error'
codeValidateMessage.value = error.message || t('login.codeVerifyFailed')
emailVerified.value = false
verificationToken.value = ''
}
}
const handlePrevious = () => {
currentStep.value--
}
......@@ -382,16 +331,6 @@ const handleNext = () => {
Message.warning(t('login.pleaseComplete'))
return
}
// 检查邮箱是否已验证
// if (!emailVerified.value) {
// Message.warning(t('login.pleaseVerifyEmail'))
// return
// }
// 检查验证码
// if (!formData.code || codeValidateStatus.value !== 'success') {
// Message.warning(t('login.pleaseVerifyCode'))
// return
// }
} else if (currentStep.value === 2) {
if (!formData.password || !formData.newPassword) {
Message.warning(t('login.pleaseComplete'))
......
......@@ -13,14 +13,24 @@
<span v-if="userInfor?.email==''" class="customColor-text-7">{{ t('personal.notYetBin') }}</span>
<span v-else class="SourceHanSansCN">
<span>{{ t('personal.securityLevel') }}</span>
<span class="customPrimary-9">{{ t('personal.low') }}</span>
<span class="customPrimary-9">
<template v-if="userInfor?.passwordSecurity<2">
{{ t('personal.low') }}
</template>
<template v-else-if="userInfor?.passwordSecurity==2">
{{ t('personal.medium') }}
</template>
<template v-else-if="userInfor?.passwordSecurity==3">
{{ t('personal.high') }}
</template>
</span>
</span>
</div>
<div class="w-[415px] leading-[20px] SourceHanSansCN">
<div class="w-[325px] customColor-text-7">{{ t('personal.passwordSecurityTip') }}</div>
</div>
<div class="flex-1 flex justify-end items-end">
<a-button @click="goPage('/forgePassword/'+userInfor.email)"
<a-button @click="goPage('/perForgePassword/'+userInfor.email)"
type="primary"
size="large"
class="acc-button !h-[34px] !rounded-[8px] !text-sm !px-[13px]">
......@@ -158,6 +168,7 @@ import { Message } from '@arco-design/web-vue'
import { query } from '@/utils/common'
import { useRouter } from 'vue-router'
import UserService from '@/services/UserService'
import providerTypeEnum from '@/utils/providerTypeEnum'
const { t } = useI18n();
const router = useRouter()
......@@ -170,16 +181,6 @@ const systemConfig = reactive({
const loginType = ref(userStore.loginType)
const userInfor = ref<any>(userStore.personalInfor)
const orderList = ref<any>([])
const currentStatus = ref(0)
const queryParams = ref<any>({
pageIndex: 1,
pageSize: 10,
orderStatus: currentStatus.value,
})
const loading = ref(true)
// 绑定Google账号
const googleButtonContainer = ref(null);
......@@ -211,18 +212,21 @@ const goPage = (path: string) => {
const unBindWeChatAccount = async (type: number) => {
loading.value = true
let ProviderType = null as string
let provider = null as string
if(type==2){
ProviderType = WeChatInfor.value.id
provider = WeChatInfor.value.provider
}else if(type==1){
ProviderType = LnlineInfor.value.id
provider = LnlineInfor.value.provider
}else if(type==3){
ProviderType = GoogleInfor.value.id
provider = GoogleInfor.value.provider
}
try {
const response = await UserService.externalunbindBind(systemConfig.tenantId,ProviderType)
if (response.status == 'SUCCESS'){
const response = await UserService.externalunbindBind(systemConfig.tenantId,provider)
if (response){
Message.success(t('personal.unBindSuccess'))
getPersonalInfor()
}else{
Message.error(t('personal.unBindError'))
}
}catch (error: any) {
Message.error(error.message || t('login.bindGoogleFailed'))
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment