Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/blue-laws-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@scow/mis-web": patch
---

用户修改邮箱增加校验权限
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const ChangeEmailModal: React.FC<Props> = ({
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"))); })
Expand Down
11 changes: 5 additions & 6 deletions apps/mis-web/src/pages/api/profile/changeEmail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export const ChangeEmailSchema = typeboxRouteSchema({
method: "PATCH",

body: Type.Object({
userId:Type.String(),
newEmail: Type.String(),
}),

Expand All @@ -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 }))
Expand Down
Loading