R91 A3-A4 收口企微移动默认入口
这个提交包含在:
@@ -11,7 +11,7 @@ const BIND_COOKIE_NAME = "wecom_bind";
|
||||
const PENDING_LOGIN_BIND_COOKIE_NAME = "wecom_login_bind";
|
||||
const DEVICE_FINGERPRINT_COOKIE_NAME = "hyb_oa_device_fingerprint";
|
||||
const DATE_WINDOW_MS = 10 * 60 * 1000;
|
||||
const DEFAULT_RETURN_TO = "/portal";
|
||||
const DEFAULT_RETURN_TO = "/mobile";
|
||||
const DISABLED_STATUS_REASONS = new Set(["wecom_disabled", "entry_disabled", "oauth_disabled"]);
|
||||
const QUERY_SCHEMA = z.object({
|
||||
returnTo: z.string().optional(),
|
||||
|
||||
@@ -117,7 +117,7 @@ describe("wecom auth routes R27", () => {
|
||||
bindEnabled: true,
|
||||
oauthEnabled: true,
|
||||
status: "disabled",
|
||||
defaultReturnTo: "/portal",
|
||||
defaultReturnTo: "/mobile",
|
||||
loginUrl: null,
|
||||
statusReasons: expect.arrayContaining(["entry_disabled"]),
|
||||
}));
|
||||
@@ -125,6 +125,23 @@ describe("wecom auth routes R27", () => {
|
||||
await app.close();
|
||||
});
|
||||
|
||||
it("returns mobile-first login url when entry is ready", async () => {
|
||||
const app = await buildApp();
|
||||
|
||||
const response = await app.inject({ method: "GET", url: "/api/auth/wecom/config" });
|
||||
|
||||
expect(response.statusCode).toBe(200);
|
||||
expect(response.json().data).toEqual(expect.objectContaining({
|
||||
enabled: true,
|
||||
entryEnabled: true,
|
||||
status: "ready",
|
||||
defaultReturnTo: "/mobile",
|
||||
loginUrl: "/api/auth/wecom/login?returnTo=%2Fmobile",
|
||||
}));
|
||||
|
||||
await app.close();
|
||||
});
|
||||
|
||||
it("returns misconfigured status when corp id is missing", async () => {
|
||||
const app = await buildApp({ config: { wecomCorpId: "" } });
|
||||
|
||||
@@ -157,7 +174,7 @@ describe("wecom auth routes R27", () => {
|
||||
const state = new URL(location).searchParams.get("state");
|
||||
const verified = verifyToken(state, JWT_SECRET);
|
||||
expect(verified.ok).toBe(true);
|
||||
expect(verified.payload.returnTo).toBe("/portal");
|
||||
expect(verified.payload.returnTo).toBe("/mobile");
|
||||
expect(verified.payload.mode).toBe("login");
|
||||
expect(String(verified.payload.deviceFingerprint ?? "")).toMatch(/^wecom:/);
|
||||
|
||||
|
||||
在新工单中引用
屏蔽一个用户