Fix #1930 add option to autodetect dark mode in reCAPTCHA

This commit is contained in:
Kijin Sung 2022-04-25 02:02:29 +09:00
parent 8d89f256e6
commit ec18bf34bd
5 changed files with 10 additions and 3 deletions

View file

@ -34,6 +34,7 @@
<label class="x_control-label" for="captcha_theme">{$lang->recaptcha_theme}</label>
<div class="x_controls">
<select id="captcha_theme" name="captcha_theme">
<option value="auto" selected="selected"|cond="$config->captcha->theme === 'auto'">{$lang->recaptcha_theme_auto}</option>
<option value="light" selected="selected"|cond="$config->captcha->theme === 'light'">{$lang->recaptcha_theme_light}</option>
<option value="dark" selected="selected"|cond="$config->captcha->theme === 'dark'">{$lang->recaptcha_theme_dark}</option>
</select>

View file

@ -47,10 +47,14 @@ function reCaptchaCallback() {
recaptcha_instances.each(function() {
var instance = $(this);
var theme = recaptcha_config.data("theme");
if (theme === 'auto') {
theme = getColorScheme();
}
grecaptcha.render(instance.attr("id"), {
sitekey: recaptcha_config.data("sitekey"),
size: recaptcha_config.data("size"),
theme: recaptcha_config.data("theme")
theme: theme
});
});
}