Fix #17860 - Add Captcha for public member's subscription form
This commit is contained in:
parent
44627f0caa
commit
abaff59d4d
@ -83,7 +83,7 @@ $backtopage = GETPOST('backtopage', 'alpha');
|
|||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
|
|
||||||
// Load translation files
|
// Load translation files
|
||||||
$langs->loadLangs(array("main", "members", "companies", "install", "other"));
|
$langs->loadLangs(array("main", "members", "companies", "install", "other", "errors"));
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if (empty($conf->adherent->enabled)) {
|
if (empty($conf->adherent->enabled)) {
|
||||||
@ -257,6 +257,17 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check Captcha code if is enabled
|
||||||
|
if (!empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) {
|
||||||
|
$sessionkey = 'dol_antispam_value';
|
||||||
|
$ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) == strtolower($_POST['code'])));
|
||||||
|
if (!$ok) {
|
||||||
|
$error++;
|
||||||
|
$errmsg .= $langs->trans("ErrorBadValueForCode")."<br>\n";
|
||||||
|
//$action = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$public = GETPOSTISSET('public') ? 1 : 0;
|
$public = GETPOSTISSET('public') ? 1 : 0;
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
@ -789,6 +800,20 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Display Captcha code if is enabled
|
||||||
|
if (!empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) {
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||||
|
print '<tr><td class="titlefield"><label for="email"><span class="fieldrequired">'.$langs->trans("SecurityCode").'</span></label></td><td>';
|
||||||
|
print '<span class="span-icon-security inline-block">';
|
||||||
|
print '<input id="securitycode" placeholder="'.$langs->trans("SecurityCode").'" class="flat input-icon-security width150" type="text" maxlength="5" name="code" tabindex="3" />';
|
||||||
|
print '</span>';
|
||||||
|
print '<span class="nowrap inline-block">';
|
||||||
|
print '<img class="inline-block valignmiddle" src="'.DOL_URL_ROOT.'/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" />';
|
||||||
|
print '<a class="inline-block valignmiddle" href="'.$php_self.'" tabindex="4" data-role="button">'.img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"').'</a>';
|
||||||
|
print '</span>';
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
print dol_get_fiche_end();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user