dolibarr 25.0.0-alpha
modules_captcha.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 * or see https://www.gnu.org/
19 */
20
31abstract class ModeleCaptcha
32{
36 public $id;
37
41 public $version;
42
46 public $position = 50;
47
51 public $picto = 'generic';
52
56 public $error = '';
57
61 public $db;
62
66 public $conf;
67
71 public $langs;
72
76 public $user;
77
78
84 public function isEnabled()
85 {
86 return true;
87 }
88
89
95 public function getDescription()
96 {
97 global $langs;
98 return $langs->trans("NoDescription");
99 }
100
106 public function getFieldInputTitle()
107 {
108 return "SecurityCode";
109 }
110
116 public function getExample()
117 {
118 global $langs;
119 $langs->load("bills");
120 return $langs->trans("NoExample");
121 }
122
129 public function getCaptchaCodeForForm($php_self = '')
130 {
131 return '';
132 }
133
141 {
142 return 1;
143 }
144}
Parent class for password rules/management modules.
validateCodeAfterLoginSubmit()
Validate a captcha This function is called after a log to validate a captcha, before validating a pas...
getDescription()
Return description of module.
getFieldInputTitle()
Return description of module.
getExample()
Return an example of password generated by this module.
isEnabled()
Return if a module can be used or not.
getCaptchaCodeForForm($php_self='')
Return the HTML content to output on a form that need the captcha.