New feature: add antispam question to register (configurable in config file)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@8 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
parent
9cbba1119c
commit
5dc06c320a
3 changed files with 21 additions and 1 deletions
|
@ -84,6 +84,9 @@ $dbname = 'scuttle';
|
||||||
# filetypes : An array of bookmark extensions that Scuttle should
|
# filetypes : An array of bookmark extensions that Scuttle should
|
||||||
# add system tags for.
|
# add system tags for.
|
||||||
# reservedusers : An array of usernames that cannot be registered
|
# reservedusers : An array of usernames that cannot be registered
|
||||||
|
#
|
||||||
|
# antispamQuestion: A question to avoid spam
|
||||||
|
# antispamAnswer: The answer to the question (users have to put exactly the same answer)
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
$sitename = 'SemanticScuttle';
|
$sitename = 'SemanticScuttle';
|
||||||
|
@ -118,5 +121,8 @@ $filetypes = array(
|
||||||
);
|
);
|
||||||
$reservedusers = array('all', 'watchlist');
|
$reservedusers = array('all', 'watchlist');
|
||||||
|
|
||||||
|
$antispamQuestion = 'Put here the answer to 1 + 2 + 3';
|
||||||
|
$antispamAnswer = '6';
|
||||||
|
|
||||||
include_once('debug.inc.php');
|
include_once('debug.inc.php');
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -44,6 +44,10 @@ if ($_POST['submitted']) {
|
||||||
} elseif (!$userservice->isValidEmail($_POST['email'])) {
|
} elseif (!$userservice->isValidEmail($_POST['email'])) {
|
||||||
$tplVars['error'] = T_('E-mail address is not valid. Please try again.');
|
$tplVars['error'] = T_('E-mail address is not valid. Please try again.');
|
||||||
|
|
||||||
|
// Check if antispam answer is valid
|
||||||
|
} elseif (strcmp($antispamAnswer, $GLOBALS['antispamAnswer']) != 0) {
|
||||||
|
$tplVars['error'] = T_('Antispam answer is not valid. Please try again.');
|
||||||
|
|
||||||
// Register details
|
// Register details
|
||||||
} elseif ($userservice->addUser($posteduser, $_POST['password'], $_POST['email'])) {
|
} elseif ($userservice->addUser($posteduser, $_POST['password'], $_POST['email'])) {
|
||||||
// Log in with new username
|
// Log in with new username
|
||||||
|
@ -57,6 +61,7 @@ if ($_POST['submitted']) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tplVars['antispamQuestion'] = $GLOBALS['antispamQuestion'];
|
||||||
$tplVars['loadjs'] = true;
|
$tplVars['loadjs'] = true;
|
||||||
$tplVars['subtitle'] = T_('Register');
|
$tplVars['subtitle'] = T_('Register');
|
||||||
$tplVars['formaction'] = createURL('register');
|
$tplVars['formaction'] = createURL('register');
|
||||||
|
|
|
@ -27,6 +27,15 @@ window.onload = function() {
|
||||||
<td><input type="text" id="email" name="email" size="40" class="required" /></td>
|
<td><input type="text" id="email" name="email" size="40" class="required" /></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<?php if(strlen($antispamQuestion)>0) {?>
|
||||||
|
<tr>
|
||||||
|
<th align="left"><label for="question"><?php echo T_('Antispam question'); ?></label></th>
|
||||||
|
<td><input type="text" id="antispamAnswer" name="antispamAnswer" size="40" class="required" value="<?php echo $antispamQuestion ?>"/></td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td><input type="submit" name="submitted" value="<?php echo T_('Register'); ?>" /></td>
|
<td><input type="submit" name="submitted" value="<?php echo T_('Register'); ?>" /></td>
|
||||||
|
|
Loading…
Reference in a new issue