mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-02-04 07:43:28 +08:00
feat: 添加钉钉登录
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
DomainListUserResp,
|
||||
DomainLoginReq,
|
||||
DomainLoginResp,
|
||||
DomainOAuthURLResp,
|
||||
DomainRegisterReq,
|
||||
DomainSetting,
|
||||
DomainUpdateSettingReq,
|
||||
@@ -32,6 +33,8 @@ import {
|
||||
GetListAdminUserParams,
|
||||
GetListUserParams,
|
||||
GetLoginHistoryParams,
|
||||
GetUserOauthCallbackParams,
|
||||
GetUserOauthSignupOrInParams,
|
||||
WebResp,
|
||||
} from "./types";
|
||||
|
||||
@@ -401,6 +404,66 @@ export const getLoginHistory = (
|
||||
...params,
|
||||
});
|
||||
|
||||
/**
|
||||
* @description 用户 OAuth 回调
|
||||
*
|
||||
* @tags User
|
||||
* @name GetUserOauthCallback
|
||||
* @summary 用户 OAuth 回调
|
||||
* @request GET:/api/v1/user/oauth/callback
|
||||
* @response `200` `(WebResp & {
|
||||
data?: string,
|
||||
|
||||
})` OK
|
||||
*/
|
||||
|
||||
export const getUserOauthCallback = (
|
||||
query: GetUserOauthCallbackParams,
|
||||
params: RequestParams = {},
|
||||
) =>
|
||||
request<
|
||||
WebResp & {
|
||||
data?: string;
|
||||
}
|
||||
>({
|
||||
path: `/api/v1/user/oauth/callback`,
|
||||
method: "GET",
|
||||
query: query,
|
||||
type: ContentType.Json,
|
||||
format: "json",
|
||||
...params,
|
||||
});
|
||||
|
||||
/**
|
||||
* @description 用户 OAuth 登录或注册
|
||||
*
|
||||
* @tags User
|
||||
* @name GetUserOauthSignupOrIn
|
||||
* @summary 用户 OAuth 登录或注册
|
||||
* @request GET:/api/v1/user/oauth/signup-or-in
|
||||
* @response `200` `(WebResp & {
|
||||
data?: DomainOAuthURLResp,
|
||||
|
||||
})` OK
|
||||
*/
|
||||
|
||||
export const getUserOauthSignupOrIn = (
|
||||
query: GetUserOauthSignupOrInParams,
|
||||
params: RequestParams = {},
|
||||
) =>
|
||||
request<
|
||||
WebResp & {
|
||||
data?: DomainOAuthURLResp;
|
||||
}
|
||||
>({
|
||||
path: `/api/v1/user/oauth/signup-or-in`,
|
||||
method: "GET",
|
||||
query: query,
|
||||
type: ContentType.Json,
|
||||
format: "json",
|
||||
...params,
|
||||
});
|
||||
|
||||
/**
|
||||
* @description 注册用户
|
||||
*
|
||||
|
||||
@@ -16,6 +16,11 @@ export enum ConstsUserStatus {
|
||||
UserStatusLocked = "locked",
|
||||
}
|
||||
|
||||
export enum ConstsUserPlatform {
|
||||
UserPlatformEmail = "email",
|
||||
UserPlatformDingTalk = "dingtalk",
|
||||
}
|
||||
|
||||
export enum ConstsModelType {
|
||||
ModelTypeLLM = "llm",
|
||||
ModelTypeCoder = "coder",
|
||||
@@ -312,6 +317,10 @@ export interface DomainModelTokenUsageResp {
|
||||
total_output?: number;
|
||||
}
|
||||
|
||||
export interface DomainOAuthURLResp {
|
||||
url?: string;
|
||||
}
|
||||
|
||||
export interface DomainProviderModel {
|
||||
/** 模型列表 */
|
||||
models?: DomainModelBasic[];
|
||||
@@ -333,6 +342,8 @@ export interface DomainSetting {
|
||||
created_at?: number;
|
||||
/** 是否禁用密码登录 */
|
||||
disable_password_login?: boolean;
|
||||
/** 是否开启钉钉OAuth */
|
||||
enable_dingtalk_oauth?: boolean;
|
||||
/** 是否开启SSO */
|
||||
enable_sso?: boolean;
|
||||
/** 是否强制两步验证 */
|
||||
@@ -419,8 +430,14 @@ export interface DomainUpdateModelReq {
|
||||
}
|
||||
|
||||
export interface DomainUpdateSettingReq {
|
||||
/** 钉钉客户端ID */
|
||||
dingtalk_client_id?: string;
|
||||
/** 钉钉客户端密钥 */
|
||||
dingtalk_client_secret?: string;
|
||||
/** 是否禁用密码登录 */
|
||||
disable_password_login?: boolean;
|
||||
/** 是否开启钉钉OAuth */
|
||||
enable_dingtalk_oauth?: boolean;
|
||||
/** 是否开启SSO */
|
||||
enable_sso?: boolean;
|
||||
/** 是否强制两步验证 */
|
||||
@@ -637,3 +654,17 @@ export interface GetLoginHistoryParams {
|
||||
/** 每页多少条记录 */
|
||||
size?: number;
|
||||
}
|
||||
|
||||
export interface GetUserOauthCallbackParams {
|
||||
code: string;
|
||||
state: string;
|
||||
}
|
||||
|
||||
export interface GetUserOauthSignupOrInParams {
|
||||
/** 第三方平台 dingtalk */
|
||||
platform: "email" | "dingtalk";
|
||||
/** 登录成功后跳转的 URL */
|
||||
redirect_url?: string;
|
||||
/** 会话ID */
|
||||
session_id?: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user