commit 28807ba7cc60bf2dac31e9cf184a162fd7979464
parent 0a5e62d4d4654d62aa3413bf8f5031780ea7338f
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Wed, 18 Jan 2023 20:22:36 -0800
better captcha required explanation
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go
@@ -3804,6 +3804,11 @@ func UploadsDownloadHandler(c echo.Context) error {
// Captcha for bigger files
var data captchaRequiredData
data.CaptchaDescription = "Captcha required"
+ if !authUser.AccountOldEnough() {
+ data.CaptchaDescription = fmt.Sprintf("Account that are less than 3 days old must complete the captcha to download files bigger than %s", humanize.Bytes(config.MaxFileSizeBeforeDownload))
+ } else if database.UserNbDownloaded(authUser.ID, filename) >= 1 {
+ data.CaptchaDescription = fmt.Sprintf("For the second download onward of a file bigger than %s, you must complete the captcha", humanize.Bytes(config.MaxFileSizeBeforeDownload))
+ }
data.CaptchaID, data.CaptchaImg = captcha.New()
const captchaRequiredTmpl = "captcha-required"
if c.Request().Method == http.MethodGet {