';
}
diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php
index 627a6ac4634..7a6b9c14f72 100644
--- a/htdocs/core/lib/security2.lib.php
+++ b/htdocs/core/lib/security2.lib.php
@@ -273,9 +273,11 @@ if (!function_exists('dol_loginfunction')) {
// Security graphical code
$captcha = 0;
$captcha_refresh = '';
- if (function_exists("imagecreatefrompng") && getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA')) {
- $captcha = 1;
- $captcha_refresh = img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"');
+ if (getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA')) {
+ $captcha = getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA_HANDLER', 'standard');
+ if ($captcha == 'standard') {
+ $captcha_refresh = img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"');
+ }
}
// Extra link
diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php
index 0dad08cad4e..94ff4126872 100644
--- a/htdocs/core/tpl/login.tpl.php
+++ b/htdocs/core/tpl/login.tpl.php
@@ -41,6 +41,7 @@ if ($size > 10000) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
'
+@phan-var-force string $captcha
@phan-var-force string $captcha_refresh
@phan-var-force int<0,1> $dol_hide_leftmenu
@phan-var-force int<0,1> $dol_hide_topmenu
@@ -278,7 +279,22 @@ if (!empty($captcha)) {
} else {
$php_self .= '?time='.dol_print_date(dol_now(), 'dayhourlog');
}
- // TODO: provide accessible captcha variants?>
+
+ $classfile = DOL_DOCUMENT_ROOT."/core/modules/security/captcha/modCaptcha".ucfirst($captcha).'.class.php';
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+ $captchaobj = null;
+ if (dol_is_file($classfile)) {
+ // Charging the numbering class
+ $classname = "modCaptcha".ucfirst($captcha);
+ require_once $classfile;
+
+ $captchaobj = new $classname($db, $conf, $langs, $user);
+ }
+
+ if (is_object($captchaobj) && method_exists($captchaobj, 'getCaptchaCodeForForm')) {
+ // TODO: get this code using a method of captcha
+ } else {
+ ?>
@@ -293,7 +309,8 @@ if (!empty($captcha)) {
-
- * Copyright (C) 2011-2013 Laurent Destailleur
+/* Copyright (C) 2009-2010 Regis Houssin
+ * Copyright (C) 2011-2024 Laurent Destailleur
* Copyright (C) 2024 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
@@ -17,6 +17,8 @@
* along with this program. If not, see .
*/
+// Page to ask email for password forgotten
+
if (!defined('NOBROWSERNOTIF')) {
define('NOBROWSERNOTIF', 1);
}
@@ -164,7 +166,22 @@ if (!empty($captcha)) {
} else {
$php_self .= '?time='.dol_print_date(dol_now(), 'dayhourlog');
}
- // TODO: provide accessible captcha variants?>
+
+ $classfile = DOL_DOCUMENT_ROOT."/core/modules/security/captcha/modCaptcha".ucfirst($captcha).'.class.php';
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+ $captchaobj = null;
+ if (dol_is_file($classfile)) {
+ // Charging the numbering class
+ $classname = "modCaptcha".ucfirst($captcha);
+ require_once $classfile;
+
+ $captchaobj = new $classname($db, $conf, $langs, $user);
+ }
+
+ if (is_object($captchaobj) && method_exists($captchaobj, 'getCaptchaCodeForForm')) {
+ // TODO: get this code using a method of captcha
+ } else {
+ ?>
@@ -179,7 +196,8 @@ if (!empty($captcha)) {
-
- * Copyright (C) 2024 Frédéric France
+/* Copyright (C) 2022 Laurent Destailleur
+ * Copyright (C) 2024 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -205,7 +205,22 @@ if (!empty($captcha)) {
} else {
$php_self .= '?time='.dol_print_date(dol_now(), 'dayhourlog');
}
- // TODO: provide accessible captcha variants?>
+
+ $classfile = DOL_DOCUMENT_ROOT."/core/modules/security/captcha/modCaptcha".ucfirst($captcha).'.class.php';
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+ $captchaobj = null;
+ if (dol_is_file($classfile)) {
+ // Charging the numbering class
+ $classname = "modCaptcha".ucfirst($captcha);
+ require_once $classfile;
+
+ $captchaobj = new $classname($db, $conf, $langs, $user);
+ }
+
+ if (is_object($captchaobj) && method_exists($captchaobj, 'getCaptchaCodeForForm')) {
+ // TODO: get this code using a method of captcha
+ } else {
+ ?>