From 80171b5fe5287e503ee6976c5a33c70a1f6d97c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 23 Oct 2024 18:51:20 +0200 Subject: [PATCH] Update modCaptchaStandard.class.php (#31528) * Update modCaptchaStandard.class.php * Update modCaptchaStandard.class.php --- .../captcha/modCaptchaStandard.class.php | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/security/captcha/modCaptchaStandard.class.php b/htdocs/core/modules/security/captcha/modCaptchaStandard.class.php index 5e448df4ff6..7e5030be5ea 100644 --- a/htdocs/core/modules/security/captcha/modCaptchaStandard.class.php +++ b/htdocs/core/modules/security/captcha/modCaptchaStandard.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2011 Laurent Destailleur * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -23,7 +23,8 @@ * \brief File to manage captcha generation according to dolibarr native code */ -require_once DOL_DOCUMENT_ROOT.'/core/modules/security/captcha/modules_captcha.php'; + require_once DOL_DOCUMENT_ROOT.'/core/modules/security/captcha/modules_captcha.php'; + require_once DOL_DOCUMENT_ROOT.'/core/modules/security/generate/modGeneratePassStandard.class.php'; /** @@ -74,7 +75,24 @@ class modCaptchaStandard extends ModeleCaptcha */ public function getExample() { - return ''; + global $db, $conf, $langs, $user; + + $generator = new modGeneratePassStandard($db, $conf, $langs, $user); + $example = $generator->getExample(); + $img = imagecreate(80, 32); + if (!$img) { + return "Problem with GD creation"; + } + $background_color = imagecolorallocate($img, 250, 250, 250); + $ecriture_color = imagecolorallocate($img, 0, 0, 0); + imagestring($img, 4, 15, 8, $example, $ecriture_color); + + ob_start(); + imagepng($img); + $image_data = ob_get_contents(); + ob_end_clean(); + + return ''; }