mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-25 19:01:28 +01:00
92 lines
2.3 KiB
PHP
92 lines
2.3 KiB
PHP
<?php
|
|
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
|
*
|
|
* 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
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
* or see https://www.gnu.org/
|
|
*/
|
|
|
|
/**
|
|
* \file htdocs/core/modules/security/captcha/modCaptchaStandard.class.php
|
|
* \ingroup core
|
|
* \brief File to manage captcha generation according to dolibarr native code
|
|
*/
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/modules/security/captcha/modules_captcha.php';
|
|
|
|
|
|
/**
|
|
* Class to generate a password according to a dolibarr standard rule (12 random chars)
|
|
*/
|
|
class modCaptchaStandard extends ModeleCaptcha
|
|
{
|
|
/**
|
|
* @var string ID
|
|
*/
|
|
public $id;
|
|
|
|
public $picto = 'fa-shield-alt';
|
|
|
|
/**
|
|
* Constructor
|
|
*
|
|
* @param DoliDB $db Database handler
|
|
* @param Conf $conf Handler de conf
|
|
* @param Translate $langs Handler de langue
|
|
* @param User $user Handler du user connected
|
|
*/
|
|
public function __construct($db, $conf, $langs, $user)
|
|
{
|
|
$this->id = "standard";
|
|
|
|
$this->db = $db;
|
|
$this->conf = $conf;
|
|
$this->langs = $langs;
|
|
$this->user = $user;
|
|
}
|
|
|
|
/**
|
|
* Return description of module
|
|
*
|
|
* @return string Description of module
|
|
*/
|
|
public function getDescription()
|
|
{
|
|
global $langs;
|
|
return $langs->trans("DolibarrStandardCaptcha");
|
|
}
|
|
|
|
/**
|
|
* Return an example of password generated by this module
|
|
*
|
|
* @return string Example of password
|
|
*/
|
|
public function getExample()
|
|
{
|
|
return '';
|
|
}
|
|
|
|
|
|
/**
|
|
* Validate a captcha
|
|
* This function is called after a log to validate a captcha, before validating a password.
|
|
*
|
|
* @return int 0 if KO, >0 if OK
|
|
*/
|
|
public function validateCodeAfterLoginSubmit()
|
|
{
|
|
return 1;
|
|
}
|
|
}
|