From 7faa427e84ad733109bd498b214ac9fe6111e737 Mon Sep 17 00:00:00 2001 From: heheer Date: Tue, 3 Dec 2024 15:28:56 +0800 Subject: [PATCH] microsoft oauth tenantId & custom button name (#3300) --- packages/global/common/system/types/index.d.ts | 6 +++++- .../login/components/LoginForm/components/FormLayout.tsx | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/global/common/system/types/index.d.ts b/packages/global/common/system/types/index.d.ts index a2647fd2b..77658db33 100644 --- a/packages/global/common/system/types/index.d.ts +++ b/packages/global/common/system/types/index.d.ts @@ -56,7 +56,11 @@ export type FastGPTFeConfigsType = { github?: string; google?: string; wechat?: string; - microsoft?: string; + microsoft?: { + clientId?: string; + tenantId?: string; + customButton?: string; + }; }; limit?: { exportDatasetLimitMinutes?: number; diff --git a/projects/app/src/pages/login/components/LoginForm/components/FormLayout.tsx b/projects/app/src/pages/login/components/LoginForm/components/FormLayout.tsx index 2a8d65587..1403b8407 100644 --- a/projects/app/src/pages/login/components/LoginForm/components/FormLayout.tsx +++ b/projects/app/src/pages/login/components/LoginForm/components/FormLayout.tsx @@ -62,10 +62,11 @@ const FormLayout = ({ children, setPageType, pageType }: Props) => { ...(feConfigs?.oauth?.microsoft ? [ { - label: t('common:support.user.login.Microsoft'), + label: + feConfigs?.oauth?.microsoft?.customButton || t('common:support.user.login.Microsoft'), provider: OAuthEnum.microsoft, icon: 'common/microsoft', - redirectUrl: `https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=${feConfigs?.oauth?.microsoft}&response_type=code&redirect_uri=${redirectUri}&response_mode=query&scope=https%3A%2F%2Fgraph.microsoft.com%2Fuser.read&state=${state.current}` + redirectUrl: `https://login.microsoftonline.com/${feConfigs?.oauth?.microsoft?.tenantId || 'common'}/oauth2/v2.0/authorize?client_id=${feConfigs?.oauth?.microsoft?.clientId}&response_type=code&redirect_uri=${redirectUri}&response_mode=query&scope=https%3A%2F%2Fgraph.microsoft.com%2Fuser.read&state=${state.current}` } ] : []),