dolibarr 23.0.3
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
26require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
27
28
32abstract class ModeleCaptcha
33{
37 public $id;
38
42 public $version;
43
47 public $position = 50;
48
52 public $picto = 'generic';
53
57 public $error = '';
58
62 public $db;
63
67 public $conf;
68
72 public $langs;
73
77 public $user;
78
79
85 public function isEnabled()
86 {
87 return true;
88 }
89
90
96 public function getDescription()
97 {
98 global $langs;
99 return $langs->trans("NoDescription");
100 }
101
107 public function getFieldInputTitle()
108 {
109 return "SecurityCode";
110 }
111
117 public function getExample()
118 {
119 global $langs;
120 $langs->load("bills");
121 return $langs->trans("NoExample");
122 }
123
130 public function getCaptchaCodeForForm($php_self = '')
131 {
132 return '';
133 }
134
142 {
143 return 1;
144 }
145}
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.