commit a0ff4de59256de022a7bf545811ad53b7fe6a03c
parent 92a99a4c93c2ffa9396ad592caf3d1b89407de00
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Sun, 4 Dec 2022 07:34:55 -0500
cleanup
Diffstat:
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go
@@ -4043,7 +4043,7 @@ func ByteRoadChallengeHandler(c echo.Context) error {
data.CaptchaID, data.CaptchaImg = captcha.New()
setCookie := func(token string) {
- c.SetCookie(hutils.CreateCookie("challenge_byte_road_session", token, utils.OneDaySecs))
+ c.SetCookie(hutils.CreateCookie(hutils.ByteRoadCookieName, token, utils.OneDaySecs))
}
if c.Request().Method == http.MethodPost {
diff --git a/pkg/web/handlers/utils/utils.go b/pkg/web/handlers/utils/utils.go
@@ -19,6 +19,8 @@ const (
PartialAuthCookieName = "partial-auth-token"
PartialRecoveryCookieName = "partial-recovery-token"
PartialRecovery2CookieName = "partial-recovery2-token"
+ AprilFoolCookieName = "april_fool"
+ ByteRoadCookieName = "challenge_byte_road_session"
)
func CreateCookie(name, value string, maxAge int64) *http.Cookie {
@@ -83,7 +85,7 @@ func GetAprilFoolCookie(c echo.Context) int {
}
func CreateAprilFoolCookie(c echo.Context, v int) {
- c.SetCookie(CreateCookie("april_fool", strconv.Itoa(v), utils.OneDaySecs))
+ c.SetCookie(CreateCookie(AprilFoolCookieName, strconv.Itoa(v), utils.OneDaySecs))
}
// CaptchaVerifyString ensure that all captcha across the website makes HB life miserable.