fix(projects): 修复个人信息-修改密码未加密且参数错误问题
This commit is contained in:
parent
f36ac9abc6
commit
8b3151b8ce
@ -16,7 +16,7 @@ export function fetchCreateTenant(data: Api.System.TenantOperateParams) {
|
|||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
isEncrypt: true,
|
isEncrypt: true,
|
||||||
repeatSubmit: true
|
repeatSubmit: false
|
||||||
},
|
},
|
||||||
data
|
data
|
||||||
});
|
});
|
||||||
|
@ -81,7 +81,8 @@ export function fetchResetUserPassword(userId: CommonType.IdType, password: stri
|
|||||||
url: '/system/user/resetPwd',
|
url: '/system/user/resetPwd',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
headers: {
|
headers: {
|
||||||
isEncrypt: true
|
isEncrypt: true,
|
||||||
|
repeatSubmit: false
|
||||||
},
|
},
|
||||||
data: { userId, password }
|
data: { userId, password }
|
||||||
});
|
});
|
||||||
@ -118,6 +119,9 @@ export function fetchUpdateUserPassword(data: Api.System.UserPasswordOperatePara
|
|||||||
return request<boolean>({
|
return request<boolean>({
|
||||||
url: '/system/user/profile/updatePwd',
|
url: '/system/user/profile/updatePwd',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
|
headers: {
|
||||||
|
isEncrypt: true
|
||||||
|
},
|
||||||
data
|
data
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
7
src/typings/api/system.api.d.ts
vendored
7
src/typings/api/system.api.d.ts
vendored
@ -152,9 +152,10 @@ declare namespace Api {
|
|||||||
type UserProfileOperateParams = CommonType.RecordNullable<Pick<User, 'nickName' | 'email' | 'phonenumber' | 'sex'>>;
|
type UserProfileOperateParams = CommonType.RecordNullable<Pick<User, 'nickName' | 'email' | 'phonenumber' | 'sex'>>;
|
||||||
|
|
||||||
/** user password operate params */
|
/** user password operate params */
|
||||||
type UserPasswordOperateParams = CommonType.RecordNullable<
|
type UserPasswordOperateParams = CommonType.RecordNullable<{
|
||||||
Pick<User, 'userId' | 'password'> & { newPassword: string }
|
oldPassword: string;
|
||||||
>;
|
newPassword: string;
|
||||||
|
}>;
|
||||||
|
|
||||||
/** user info */
|
/** user info */
|
||||||
type UserInfo = {
|
type UserInfo = {
|
||||||
|
@ -46,14 +46,14 @@ function createDefaultProfileModel(): ProfileModel {
|
|||||||
|
|
||||||
function createDefaultPasswordModel(): PasswordModel {
|
function createDefaultPasswordModel(): PasswordModel {
|
||||||
return {
|
return {
|
||||||
password: '',
|
oldPassword: '',
|
||||||
confirmPassword: '',
|
confirmPassword: '',
|
||||||
newPassword: ''
|
newPassword: ''
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProfileRuleKey = Extract<keyof ProfileModel, 'nickName' | 'email' | 'phonenumber' | 'sex'>;
|
type ProfileRuleKey = Extract<keyof ProfileModel, 'nickName' | 'email' | 'phonenumber' | 'sex'>;
|
||||||
type PasswordRuleKey = Extract<keyof PasswordModel, 'password' | 'confirmPassword' | 'newPassword'>;
|
type PasswordRuleKey = Extract<keyof PasswordModel, 'oldPassword' | 'newPassword' | 'confirmPassword'>;
|
||||||
|
|
||||||
const profileRules: Record<ProfileRuleKey, App.Global.FormRule> = {
|
const profileRules: Record<ProfileRuleKey, App.Global.FormRule> = {
|
||||||
nickName: createRequiredRule('昵称不能为空'),
|
nickName: createRequiredRule('昵称不能为空'),
|
||||||
@ -63,7 +63,7 @@ const profileRules: Record<ProfileRuleKey, App.Global.FormRule> = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const passwordRules: Record<PasswordRuleKey, App.Global.FormRule> = {
|
const passwordRules: Record<PasswordRuleKey, App.Global.FormRule> = {
|
||||||
password: createRequiredRule('密码不能为空'),
|
oldPassword: createRequiredRule('旧密码不能为空'),
|
||||||
confirmPassword: createRequiredRule('确认密码不能为空'),
|
confirmPassword: createRequiredRule('确认密码不能为空'),
|
||||||
newPassword: createRequiredRule('新密码不能为空')
|
newPassword: createRequiredRule('新密码不能为空')
|
||||||
};
|
};
|
||||||
@ -90,7 +90,8 @@ async function updatePassword() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
startBtnLoading();
|
startBtnLoading();
|
||||||
const { error } = await fetchUpdateUserPassword(passwordModel);
|
const { oldPassword, newPassword } = passwordModel;
|
||||||
|
const { error } = await fetchUpdateUserPassword({ oldPassword, newPassword });
|
||||||
if (!error) {
|
if (!error) {
|
||||||
window.$message?.success('密码修改成功');
|
window.$message?.success('密码修改成功');
|
||||||
// 清空表单
|
// 清空表单
|
||||||
@ -185,7 +186,7 @@ async function updatePassword() {
|
|||||||
>
|
>
|
||||||
<NFormItem label="旧密码" path="password">
|
<NFormItem label="旧密码" path="password">
|
||||||
<NInput
|
<NInput
|
||||||
v-model:value="passwordModel.password"
|
v-model:value="passwordModel.oldPassword"
|
||||||
type="password"
|
type="password"
|
||||||
placeholder="请输入旧密码"
|
placeholder="请输入旧密码"
|
||||||
show-password-on="click"
|
show-password-on="click"
|
||||||
|
Loading…
Reference in New Issue
Block a user