diff --git a/.changeset/blue-laws-swim.md b/.changeset/blue-laws-swim.md new file mode 100644 index 0000000000..0ad75ae8c8 --- /dev/null +++ b/.changeset/blue-laws-swim.md @@ -0,0 +1,5 @@ +--- +"@scow/mis-web": patch +--- + +用户修改邮箱增加校验权限 diff --git a/apps/mis-web/src/pageComponents/profile/ChangeEmailModal.tsx b/apps/mis-web/src/pageComponents/profile/ChangeEmailModal.tsx index 585255c48e..cb8ec0196f 100644 --- a/apps/mis-web/src/pageComponents/profile/ChangeEmailModal.tsx +++ b/apps/mis-web/src/pageComponents/profile/ChangeEmailModal.tsx @@ -52,7 +52,7 @@ export const ChangeEmailModal: React.FC = ({ const { newEmail } = await form.validateFields(); setLoading(true); - await api.changeEmail({ body: { userId: userStore.user!.identityId, newEmail } }) + await api.changeEmail({ body: { newEmail } }) .httpError(404, () => { message.error(t(p("userNotExist"))); }) .httpError(500, () => { message.error(t(p("changeEmailFail"))); }) .httpError(501, () => { message.error(t(p("unavailable"))); }) diff --git a/apps/mis-web/src/pages/api/profile/changeEmail.ts b/apps/mis-web/src/pages/api/profile/changeEmail.ts index a8b0b60bdd..a2251d8430 100644 --- a/apps/mis-web/src/pages/api/profile/changeEmail.ts +++ b/apps/mis-web/src/pages/api/profile/changeEmail.ts @@ -29,7 +29,6 @@ export const ChangeEmailSchema = typeboxRouteSchema({ method: "PATCH", body: Type.Object({ - userId:Type.String(), newEmail: Type.String(), }), @@ -54,18 +53,18 @@ export default /* #__PURE__*/typeboxRoute(ChangeEmailSchema, async (req, res) => const info = await auth(req, res); if (!info) { return; } - + const ldapCapabilities = await getCapabilities(runtimeConfig.AUTH_INTERNAL_URL); if (!ldapCapabilities.changeEmail) { return { 501: null }; } - - const { userId, newEmail } = req.body; - + + const { newEmail } = req.body; + const client = getClient(UserServiceClient); return await asyncClientCall(client, "changeEmail", { - userId, + userId:info.identityId, newEmail, }) .then(() => ({ 204: null }))