Checkpoint: Correction complémentaire : normalisation stricte des valeurs OAuth de loginMethod avant insertion DB, afin d’éviter les erreurs de troncature causées par les identifiants de plateforme externes. Ajout de tests associés et validation build complète.

This commit is contained in:
Manus
2026-08-17 20:25:16 +00:00
parent 54164b1b33
commit d8b2a8fe6f
5 changed files with 47 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
import { COOKIE_NAME, ONE_YEAR_MS } from "@shared/const";
import type { Express, Request, Response } from "express";
import * as db from "../db";
import { normalizeLoginMethod } from "../authMethod";
import { getSessionCookieOptions } from "./cookies";
import { sdk } from "./sdk";
@@ -32,7 +33,7 @@ export function registerOAuthRoutes(app: Express) {
openId: userInfo.openId,
name: userInfo.name || null,
email: userInfo.email ?? "unknown@example.com",
loginMethod: (userInfo.loginMethod ?? userInfo.platform ?? "manus") as "manus" | "local" | "azure-ad",
loginMethod: normalizeLoginMethod(userInfo.loginMethod ?? userInfo.platform),
lastSignedIn: new Date(),
});