generated from halo-dev/plugin-starter
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add CAPTCHA verification for anonymous comments to enhance secu…
…rity (#133) #### What type of PR is this? /kind feature #### What this PR does / why we need it: 在匿名评论时增加图形验证码验证机制以提高安全性 #### Which issue(s) this PR fixes: Fixes #132 #### Does this PR introduce a user-facing change? ```release-note 在匿名评论时增加图形验证码验证机制以提高安全性 ```
- Loading branch information
Showing
22 changed files
with
841 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export const getCaptchaCodeHeader = (code: string): Record<string, string> => { | ||
if (!code || code.trim().length === 0) { | ||
return {}; | ||
} | ||
return { | ||
'X-Captcha-Code': code, | ||
}; | ||
}; | ||
|
||
export const isRequireCaptcha = (response: Response) => { | ||
return response.status === 403 && response.headers.get('X-Require-Captcha'); | ||
}; |
Oops, something went wrong.