@@ -41,7 +41,7 @@ import {
4141 upsertKey ,
4242 verifyUser ,
4343} from './storage/mongo'
44- import { limiter } from './middleware/limiter'
44+ import { authLimiter , limiter } from './middleware/limiter'
4545import { hasAnyRole , isEmail , isNotEmptyString } from './utils/is'
4646import { sendNoticeMail , sendResetPasswordMail , sendTestMail , sendVerifyMail , sendVerifyMailAdmin } from './utils/mail'
4747import { checkUserResetPassword , checkUserVerify , checkUserVerifyAdmin , getUserResetPasswordUrl , getUserVerifyUrl , getUserVerifyUrlAdmin , md5 } from './utils/security'
@@ -502,7 +502,7 @@ router.post('/chat-abort', [auth, limiter], async (req, res) => {
502502 }
503503} )
504504
505- router . post ( '/user-register' , async ( req , res ) => {
505+ router . post ( '/user-register' , authLimiter , async ( req , res ) => {
506506 try {
507507 const { username, password } = req . body as { username : string ; password : string }
508508 const config = await getCacheConfig ( )
@@ -633,7 +633,7 @@ router.post('/session', async (req, res) => {
633633 }
634634} )
635635
636- router . post ( '/user-login' , async ( req , res ) => {
636+ router . post ( '/user-login' , authLimiter , async ( req , res ) => {
637637 try {
638638 const { username, password } = req . body as { username : string ; password : string }
639639 if ( ! username || ! password || ! isEmail ( username ) )
@@ -665,7 +665,7 @@ router.post('/user-login', async (req, res) => {
665665 }
666666} )
667667
668- router . post ( '/user-send-reset-mail' , async ( req , res ) => {
668+ router . post ( '/user-send-reset-mail' , authLimiter , async ( req , res ) => {
669669 try {
670670 const { username } = req . body as { username : string }
671671 if ( ! username || ! isEmail ( username ) )
@@ -682,7 +682,7 @@ router.post('/user-send-reset-mail', async (req, res) => {
682682 }
683683} )
684684
685- router . post ( '/user-reset-password' , async ( req , res ) => {
685+ router . post ( '/user-reset-password' , authLimiter , async ( req , res ) => {
686686 try {
687687 const { username, password, sign } = req . body as { username : string ; password : string ; sign : string }
688688 if ( ! username || ! password || ! isEmail ( username ) )
@@ -771,7 +771,7 @@ router.post('/user-role', rootAuth, async (req, res) => {
771771 }
772772} )
773773
774- router . post ( '/verify' , async ( req , res ) => {
774+ router . post ( '/verify' , authLimiter , async ( req , res ) => {
775775 try {
776776 const { token } = req . body as { token : string }
777777 if ( ! token )
@@ -799,7 +799,7 @@ router.post('/verify', async (req, res) => {
799799 }
800800} )
801801
802- router . post ( '/verifyadmin' , async ( req , res ) => {
802+ router . post ( '/verifyadmin' , authLimiter , async ( req , res ) => {
803803 try {
804804 const { token } = req . body as { token : string }
805805 if ( ! token )
0 commit comments