实现企微首次免密自动绑定(07-28-all-account-login-readiness)
这个提交包含在:
@@ -370,7 +370,7 @@ describe("auth login route", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("auto-binds pending wecom identity after password login", async () => {
|
||||
it("does not use password login to bind a pending wecom identity", async () => {
|
||||
const passwordHash = await hashPassword("AdminPassword1234");
|
||||
const { app, wecomFindFirst, wecomUpsert } = await buildApp(passwordHash);
|
||||
const pendingBindToken = signPayload({
|
||||
@@ -395,38 +395,18 @@ describe("auth login route", () => {
|
||||
});
|
||||
|
||||
expect(response.statusCode).toBe(200);
|
||||
expect(wecomFindFirst).toHaveBeenCalledWith({
|
||||
where: {
|
||||
external_user_id: "wecom-user-1",
|
||||
NOT: { employee_id: EMPLOYEE_ID },
|
||||
},
|
||||
select: { employee_id: true },
|
||||
});
|
||||
expect(wecomUpsert).toHaveBeenCalledWith({
|
||||
where: { employee_id: EMPLOYEE_ID },
|
||||
update: {
|
||||
external_user_id: "wecom-user-1",
|
||||
external_open_user_id: "openid-1",
|
||||
updated_by: EMPLOYEE_ID,
|
||||
},
|
||||
create: {
|
||||
employee_id: EMPLOYEE_ID,
|
||||
external_user_id: "wecom-user-1",
|
||||
external_open_user_id: "openid-1",
|
||||
created_by: EMPLOYEE_ID,
|
||||
updated_by: EMPLOYEE_ID,
|
||||
},
|
||||
});
|
||||
expect(wecomFindFirst).not.toHaveBeenCalled();
|
||||
expect(wecomUpsert).not.toHaveBeenCalled();
|
||||
expect(response.json().data).toEqual(
|
||||
expect.objectContaining({
|
||||
accessToken: "access-token",
|
||||
mustChangePassword: false,
|
||||
wecomBindingStatus: "bound",
|
||||
wecomBindingStatus: null,
|
||||
}),
|
||||
);
|
||||
expect(response.headers["set-cookie"]).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.stringContaining("wecom_login_bind="),
|
||||
expect.stringMatching(/wecom_login_bind=;/),
|
||||
]),
|
||||
);
|
||||
|
||||
|
||||
在新工单中引用
屏蔽一个用户