Merge pull request 'Make captcha more readable' (#5) from captcha-big into forgejo
Some checks are pending
/ release (push) Waiting to run
testing / backend-checks (push) Waiting to run
testing / frontend-checks (push) Waiting to run
testing / test-unit (push) Blocked by required conditions
testing / test-e2e (push) Blocked by required conditions
testing / test-remote-cacher (redis) (push) Blocked by required conditions
testing / test-remote-cacher (valkey) (push) Blocked by required conditions
testing / test-remote-cacher (garnet) (push) Blocked by required conditions
testing / test-remote-cacher (redict) (push) Blocked by required conditions
testing / test-mysql (push) Blocked by required conditions
testing / test-pgsql (push) Blocked by required conditions
testing / test-sqlite (push) Blocked by required conditions
testing / security-check (push) Blocked by required conditions

Reviewed-on: #5
This commit is contained in:
Minecon724 2025-06-05 09:41:34 +02:00
commit 3565c27520
3 changed files with 15 additions and 1 deletions

View file

@ -1,7 +1,7 @@
{{if .EnableCaptcha}}{{if eq .CaptchaType "image"}}
<div class="inline field tw-text-center">
<input type="hidden" name="img-captcha-id" value="{{.Captcha}}">
<img style="transform: scaleX(-1);background-color: white" onclick="this.src=`{{AppSubUrl}}/captcha/{{.Captcha}}.png?reload=${Date.now()}`" class="captcha-img" src="{{AppSubUrl}}/captcha/{{.Captcha}}.png" alt="{{ctx.Locale.Tr "captcha"}}">
<img style="transform: scaleX(-1);" onclick="this.src=`{{AppSubUrl}}/captcha/{{.Captcha}}.png?reload=${Date.now()}`" class="captcha-img" src="{{AppSubUrl}}/captcha/{{.Captcha}}.png" alt="{{ctx.Locale.Tr "captcha"}}">
</div>
<div class="required field {{if .Err_Captcha}}error{{end}}">
<label for="captcha">{{ctx.Locale.Tr "captcha"}}</label>

View file

@ -626,3 +626,7 @@ input:-webkit-autofill:active,
width: 100% !important;
}
}
.captcha-img {
width: min(30em, 100%);
}

View file

@ -11,3 +11,13 @@
.markup [href$="#dark-mode-only"] {
display: unset;
}
/*
The reason we're doing this here, is because dark templates always use this file, and there's no other way to detect dark theme.
Third party templates may not, but this isn't that big, since you can't change the theme logged out.
*/
.captcha-img {
filter: invert();
/* optionally contrast filter? */
}