-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
157 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
htdocs/google/core/modules/security/captcha/modCaptchaGoogle.class.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<?php | ||
/* Copyright (C) 2006-2011 Laurent Destailleur <[email protected]> | ||
* Copyright (C) 2024 Frédéric France <[email protected]> | ||
* | ||
* 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 modCaptchaGoogle 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 = strtolower(preg_replace('/^modCaptcha/i', '', get_class())); | ||
|
||
//$this->picto = 'fab-google'; | ||
|
||
$this->db = $db; | ||
$this->conf = $conf; | ||
Check warning on line 56 in htdocs/google/core/modules/security/captcha/modCaptchaGoogle.class.php
|
||
$this->langs = $langs; | ||
Check warning on line 57 in htdocs/google/core/modules/security/captcha/modCaptchaGoogle.class.php
|
||
$this->user = $user; | ||
Check warning on line 58 in htdocs/google/core/modules/security/captcha/modCaptchaGoogle.class.php
|
||
} | ||
|
||
/** | ||
* Return description of module | ||
* | ||
* @return string Description of module | ||
*/ | ||
public function getDescription() | ||
{ | ||
global $langs; | ||
return $langs->trans("GoogleCaptchaV3"); | ||
} | ||
|
||
/** | ||
* 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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters