Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
6e6b026d
authored
Mar 26, 2026
by
Archer
Committed by
GitHub
Mar 26, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: auth code secret (#6662)
parent
34c85ad5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
15 deletions
+14
-15
packages/service/support/user/auth/controller.ts
+9
-10
projects/app/src/pages/api/support/openapi/health.ts
+5
-5
No files found.
packages/service/support/user/auth/controller.ts
View file @
6e6b026d
import
type
{
UserAuthTypeEnum
}
from
'@fastgpt/global/support/user/auth/constants'
;
import
{
UserAuthTypeEnum
}
from
'@fastgpt/global/support/user/auth/constants'
;
import
{
MongoUserAuth
}
from
'./schema'
;
import
{
i18nT
}
from
'../../../../web/i18n/utils'
;
import
{
mongoSessionRun
}
from
'../../../common/mongo/sessionRun'
;
import
{
UserError
}
from
'@fastgpt/global/common/error/utils'
;
import
{
z
}
from
'zod'
;
export
const
addAuthCode
=
async
({
key
,
...
...
@@ -33,15 +34,13 @@ export const addAuthCode = async ({
);
};
export
const
authCode
=
async
({
key
,
type
,
code
}:
{
key
:
string
;
type
:
`
${
UserAuthTypeEnum
}
`
;
code
:
string
;
})
=>
{
const
authCodeSchema
=
z
.
object
({
key
:
z
.
string
(),
type
:
z
.
enum
(
UserAuthTypeEnum
),
code
:
z
.
string
()
});
export
const
authCode
=
async
(
props
:
z
.
infer
<
typeof
authCodeSchema
>
)
=>
{
const
{
key
,
type
,
code
}
=
authCodeSchema
.
parse
(
props
);
return
mongoSessionRun
(
async
(
session
)
=>
{
const
result
=
await
MongoUserAuth
.
findOne
(
{
...
...
projects/app/src/pages/api/support/openapi/health.ts
View file @
6e6b026d
import
type
{
ApiRequestProps
,
ApiResponseType
}
from
'@fastgpt/service/type/next'
;
import
{
NextAPI
}
from
'@/service/middleware/entry'
;
import
type
{
ApiKeyHealthParamsType
,
ApiKeyHealthResponseType
}
from
'@fastgpt/global/openapi/support/openapi/api'
;
import
{
ApiKeyHealthParamsSchema
}
from
'@fastgpt/global/openapi/support/openapi/api'
;
import
{
MongoOpenApi
}
from
'@fastgpt/service/support/openapi/schema'
;
import
{
useIPFrequencyLimit
}
from
'../../../../../../../packages/service/common/middle/reqFrequencyLimit'
;
export
type
invalidBody
=
{};
async
function
handler
(
req
:
ApiRequestProps
<
invalidBody
,
ApiKeyHealthParamsType
>
,
req
:
ApiRequestProps
,
res
:
ApiResponseType
<
any
>
):
Promise
<
ApiKeyHealthResponseType
>
{
const
{
apiKey
}
=
req
.
query
;
const
{
apiKey
}
=
ApiKeyHealthParamsSchema
.
parse
(
req
.
query
)
;
const
apiKeyDoc
=
await
MongoOpenApi
.
findOne
({
apiKey
}).
lean
();
if
(
!
apiKeyDoc
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment