mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-04-29 06:38:38 +00:00
fix: 添加接口速率限制中间件,优化验证码输入框交互体验
This commit is contained in:
@@ -114,7 +114,7 @@ func SetApiRouter(router *gin.Engine) {
|
|||||||
channelRoute.GET("/models", controller.ChannelListModels)
|
channelRoute.GET("/models", controller.ChannelListModels)
|
||||||
channelRoute.GET("/models_enabled", controller.EnabledListModels)
|
channelRoute.GET("/models_enabled", controller.EnabledListModels)
|
||||||
channelRoute.GET("/:id", controller.GetChannel)
|
channelRoute.GET("/:id", controller.GetChannel)
|
||||||
channelRoute.POST("/:id/key", controller.GetChannelKey)
|
channelRoute.POST("/:id/key", middleware.CriticalRateLimit(), controller.GetChannelKey)
|
||||||
channelRoute.GET("/test", controller.TestAllChannels)
|
channelRoute.GET("/test", controller.TestAllChannels)
|
||||||
channelRoute.GET("/test/:id", controller.TestChannel)
|
channelRoute.GET("/test/:id", controller.TestChannel)
|
||||||
channelRoute.GET("/update_balance", controller.UpdateAllChannelsBalance)
|
channelRoute.GET("/update_balance", controller.UpdateAllChannelsBalance)
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ const TwoFactorAuthModal = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const handleKeyPress = (e) => {
|
const handleKeyDown = (e) => {
|
||||||
if (e.key === 'Enter' && code) {
|
if (e.key === 'Enter' && code && !loading) {
|
||||||
onVerify();
|
onVerify();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -75,7 +75,7 @@ const TwoFactorAuthModal = ({
|
|||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
loading={loading}
|
loading={loading}
|
||||||
disabled={!code}
|
disabled={!code || loading}
|
||||||
onClick={onVerify}
|
onClick={onVerify}
|
||||||
>
|
>
|
||||||
{t('验证')}
|
{t('验证')}
|
||||||
@@ -114,7 +114,8 @@ const TwoFactorAuthModal = ({
|
|||||||
onChange={onCodeChange}
|
onChange={onCodeChange}
|
||||||
size="large"
|
size="large"
|
||||||
maxLength={8}
|
maxLength={8}
|
||||||
onKeyPress={handleKeyPress}
|
onKeyDown={handleKeyDown}
|
||||||
|
autoFocus
|
||||||
/>
|
/>
|
||||||
<Typography.Text type="tertiary" size="small" className="mt-2 block">
|
<Typography.Text type="tertiary" size="small" className="mt-2 block">
|
||||||
{t('支持6位TOTP验证码或8位备用码')}
|
{t('支持6位TOTP验证码或8位备用码')}
|
||||||
|
|||||||
Reference in New Issue
Block a user