Skip to content

Commit

Permalink
feat: add microsoft oauth (#3152)
Browse files Browse the repository at this point in the history
  • Loading branch information
newfish-cmyk authored Nov 14, 2024
1 parent 0472dc2 commit 0c9e10d
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 8 deletions.
1 change: 1 addition & 0 deletions packages/global/common/system/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export type FastGPTFeConfigsType = {
github?: string;
google?: string;
wechat?: string;
microsoft?: string;
};
limit?: {
exportDatasetLimitMinutes?: number;
Expand Down
3 changes: 2 additions & 1 deletion packages/global/support/user/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ export const userStatusMap = {
export enum OAuthEnum {
github = 'github',
google = 'google',
wechat = 'wechat'
wechat = 'wechat',
microsoft = 'microsoft'
}
1 change: 1 addition & 0 deletions packages/web/components/common/Icon/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const iconPaths = {
'common/list': () => import('./icons/common/list.svg'),
'common/loading': () => import('./icons/common/loading.svg'),
'common/logLight': () => import('./icons/common/logLight.svg'),
'common/microsoft': () => import('./icons/common/microsoft.svg'),
'common/monitor': () => import('./icons/common/monitor.svg'),
'common/navbar/pluginFill': () => import('./icons/common/navbar/pluginFill.svg'),
'common/navbar/pluginLight': () => import('./icons/common/navbar/pluginLight.svg'),
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/web/i18n/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,7 @@
"support.user.login.Email": "Email",
"support.user.login.Github": "GitHub Login",
"support.user.login.Google": "Google Login",
"support.user.login.Microsoft": "Microsoft Login",
"support.user.login.Password": "Password",
"support.user.login.Password login": "Password Login",
"support.user.login.Phone": "Phone Login",
Expand Down
15 changes: 8 additions & 7 deletions packages/web/i18n/zh/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
"FAQ.switch_package_a": "套餐使用规则为优先使用更高级的套餐,因此,购买的新套餐若比当前套餐更高级,则新套餐立即生效:否则将继续使用当前套餐。",
"FAQ.switch_package_q": "是否切换订阅套餐?",
"Folder": "文件夹",
"just_now": "刚刚",
"yesterday": "昨天",
"yesterday_detail_time": "昨天 {{time}}",
"Login": "登录",
"Move": "移动",
"Name": "名称",
Expand Down Expand Up @@ -125,6 +122,7 @@
"common.Documents": "文档",
"common.Done": "完成",
"common.Edit": "编辑",
"common.Error": "错误",
"common.Exit": "退出",
"common.Exit Directly": "直接退出",
"common.Expired Time": "过期时间",
Expand Down Expand Up @@ -194,7 +192,6 @@
"common.Update Successful": "更新成功",
"common.Username": "用户名",
"common.Waiting": "等待中",
"common.Error": "错误",
"common.Warning": "警告",
"common.Website": "网站",
"common.all_result": "完整结果",
Expand Down Expand Up @@ -551,6 +548,7 @@
"core.dataset.import.Chunk Range": "范围:{{min}}~{{max}}",
"core.dataset.import.Chunk Split": "直接分段",
"core.dataset.import.Chunk Split Tip": "将文本按一定的规则进行分段处理后,转成可进行语义搜索的格式,适合绝大多数场景。不需要调用模型额外处理,成本低。",
"core.dataset.import.Continue upload": "继续上传",
"core.dataset.import.Custom process": "自定义规则",
"core.dataset.import.Custom process desc": "自定义设置数据处理规则",
"core.dataset.import.Custom prompt": "自定义提示词",
Expand Down Expand Up @@ -579,11 +577,10 @@
"core.dataset.import.Select source": "选择来源",
"core.dataset.import.Source name": "来源名",
"core.dataset.import.Sources list": "来源列表",
"core.dataset.import.Continue upload": "继续上传",
"core.dataset.import.Upload complete": "完成上传",
"core.dataset.import.Start upload": "开始上传",
"core.dataset.import.Total files": "共 {{total}} 个文件",
"core.dataset.import.Training mode": "训练模式",
"core.dataset.import.Upload complete": "完成上传",
"core.dataset.import.Upload data": "确认上传",
"core.dataset.import.Upload file progress": "文件上传进度",
"core.dataset.import.Upload status": "状态",
Expand Down Expand Up @@ -894,6 +891,7 @@
"is_using": "正在使用",
"item_description": "字段描述",
"item_name": "字段名",
"just_now": "刚刚",
"key_repetition": "key 重复",
"move.confirm": "确认移动",
"navbar.Account": "账号",
Expand Down Expand Up @@ -998,6 +996,7 @@
"support.user.login.Email": "邮箱",
"support.user.login.Github": "GitHub 登录",
"support.user.login.Google": "Google 登录",
"support.user.login.Microsoft": "微软登录",
"support.user.login.Password": "密码",
"support.user.login.Password login": "密码登录",
"support.user.login.Phone": "手机号登录",
Expand Down Expand Up @@ -1214,5 +1213,7 @@
"user.type": "类型",
"verification": "验证",
"xx_search_result": "{{key}} 的搜索结果",
"yes": ""
"yes": "",
"yesterday": "昨天",
"yesterday_detail_time": "昨天 {{time}}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ const FormLayout = ({ children, setPageType, pageType }: Props) => {
}
]
: []),
...(feConfigs?.oauth?.microsoft
? [
{
label: 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}`
}
]
: []),
...(pageType !== LoginPageTypeEnum.passwordLogin
? [
{
Expand Down

0 comments on commit 0c9e10d

Please sign in to comment.