Commit 051a9f21 by light5980 Committed by GitHub

fix certification (#7270)

* fix certification

* refactor(service): remove redundant methodGuard middleware

The method guard logic is no longer needed as it is handled or
superseded by current architectural practices. This change cleans up
unused utility code and its associated tests.

---------

Co-authored-by: Finley Ge <finleyge@fastgpt.io>
parent bf5502c5
......@@ -39,6 +39,13 @@ export const EnterpriseAuthPendingTaskStatuses = [
TeamEnterpriseAuthTaskStatusEnum.amount_failed
] as const;
export const EnterpriseAuthLockedTaskStatuses = [
TeamEnterpriseAuthTaskStatusEnum.starting,
TeamEnterpriseAuthTaskStatusEnum.pending_amount,
TeamEnterpriseAuthTaskStatusEnum.amount_failed,
TeamEnterpriseAuthTaskStatusEnum.verified
] as const;
const EnterpriseAuthErrValueSchema = z.enum([
'enterpriseAuthDisabled',
'enterpriseAuthServiceNotConfigured',
......
import type { NextApiResponse } from 'next';
import type { ApiRequestProps } from '../../type/next';
import { jsonRes } from '../response';
type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS';
/**
* 限制 NextAPI 路由允许的 HTTP method。
* method 不匹配时直接返回 405,并写入 Allow header,避免后续业务 handler 继续执行。
*/
export function useAllowedMethods(...methods: HttpMethod[]) {
const allowedMethods = methods.map((method) => method.toUpperCase());
return async (req: ApiRequestProps, res: NextApiResponse) => {
const requestMethod = req.method?.toUpperCase() ?? '';
if (allowedMethods.includes(requestMethod)) {
return;
}
res.setHeader('Allow', allowedMethods.join(', '));
jsonRes(res, {
code: 405,
message: `Method ${requestMethod || 'UNKNOWN'} Not Allowed`
});
};
}
Subproject commit dd14c92c8816a91dc85611cb3d749b3fac5f4bed
Subproject commit c37a34e9ac142a168af29b5dfcece1b12cccdcca
......@@ -100,7 +100,7 @@ const EnterpriseAuthNoticeModal = () => {
}
}, [setEnterpriseAuthNoticeRead, teamId]);
const onClickRead = useCallback(() => {
const onClose = useCallback(() => {
markAsRead();
setIsClosed(true);
}, [markAsRead]);
......@@ -119,11 +119,11 @@ const EnterpriseAuthNoticeModal = () => {
return (
<MyModal
isOpen
onClose={() => setIsClosed(true)}
onClose={onClose}
isCentered
size={'md'}
title={t('common:enterprise_auth_notice_title')}
footer={<Button onClick={onClickRead}>{t('common:enterprise_auth_notice_read')}</Button>}
footer={<Button onClick={onClose}>{t('common:enterprise_auth_notice_read')}</Button>}
>
<Flex flexDirection={'column'} gap={6} overflow={'hidden'}>
<Box>
......
......@@ -98,21 +98,22 @@ export const fieldRules = {
export const formLabelStyles = {
color: 'myGray.800',
fontSize: '10px',
fontSize: '12px',
fontWeight: 500,
lineHeight: '16px',
letterSpacing: '0.5px'
};
export const formErrorTextStyles = {
...formLabelStyles,
color: 'red.600'
color: 'red.600',
fontSize: '12px',
fontWeight: 500,
lineHeight: '16px',
letterSpacing: '0.5px'
};
export const fieldErrorTextStyles = {
...formErrorTextStyles,
fontSize: '10px',
lineHeight: '16px'
...formErrorTextStyles
};
export const invalidInputStyles = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment