mirror of
https://github.com/labring/FastGPT.git
synced 2026-05-06 01:02:54 +08:00
fix: login secret (#6635)
* fix: login secret * lock * env template * fix: ts * fix: ts * fix: ts
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { AdminInformPath } from './inform';
|
||||
import { AdminLoginPath } from './login';
|
||||
import type { OpenAPIPath } from '../../../type';
|
||||
|
||||
export const AdminUserPath: OpenAPIPath = {
|
||||
...AdminInformPath
|
||||
...AdminInformPath,
|
||||
...AdminLoginPath
|
||||
};
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
// Admin login request body
|
||||
export const AdminLoginBodySchema = z.object({
|
||||
username: z.string().meta({ description: '用户名' }),
|
||||
password: z.string().meta({ description: '密码' })
|
||||
});
|
||||
export type AdminLoginBodyType = z.infer<typeof AdminLoginBodySchema>;
|
||||
|
||||
// Admin login response
|
||||
export const AdminLoginResponseSchema = z.object({
|
||||
user: z.any().meta({ description: '用户信息' }),
|
||||
token: z.string().meta({ description: '登录令牌' })
|
||||
});
|
||||
export type AdminLoginResponseType = z.infer<typeof AdminLoginResponseSchema>;
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { OpenAPIPath } from '../../../../type';
|
||||
import { AdminLoginBodySchema, AdminLoginResponseSchema } from './api';
|
||||
import { TagsMap } from '../../../../tag';
|
||||
|
||||
export const AdminLoginPath: OpenAPIPath = {
|
||||
'/admin/support/user/login': {
|
||||
post: {
|
||||
summary: '管理员登录',
|
||||
description: '管理员使用用户名和密码登录',
|
||||
tags: [TagsMap.userLogin],
|
||||
requestBody: {
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: AdminLoginBodySchema
|
||||
}
|
||||
}
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
description: '登录成功',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: AdminLoginResponseSchema
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user