Require that user type in two passwords and check they match when registering.

This commit is contained in:
James 2012-10-22 13:48:14 +01:00 committed by Christian Weiske
parent cb4b0469ca
commit 6607747b37
2 changed files with 10 additions and 0 deletions

View File

@ -22,6 +22,11 @@ window.onload = function() {
<td><input type="password" id="password" name="password" size="20" class="required" /></td> <td><input type="password" id="password" name="password" size="20" class="required" /></td>
<td></td> <td></td>
</tr> </tr>
<tr>
<th align="left"><label for="password2"><?php echo T_('Repeat Password'); ?></label></th>
<td><input type="password" id="password2" name="password2" size="20" class="required" /></td>
<td></td>
</tr>
<tr> <tr>
<th align="left"><label for="email"><?php echo T_('E-mail'); ?></label></th> <th align="left"><label for="email"><?php echo T_('E-mail'); ?></label></th>
<td><input type="text" id="email" name="email" size="40" class="required" value="<?php echo htmlspecialchars(POST_MAIL); ?>" /></td> <td><input type="text" id="email" name="email" size="40" class="required" value="<?php echo htmlspecialchars(POST_MAIL); ?>" /></td>

View File

@ -34,6 +34,7 @@ if (!$GLOBALS['enableRegistration']) {
isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', ''); isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', '');
isset($_POST['username']) ? define('POST_USERNAME', $_POST['username']): define('POST_USERNAME', ''); isset($_POST['username']) ? define('POST_USERNAME', $_POST['username']): define('POST_USERNAME', '');
isset($_POST['password']) ? define('POST_PASS', $_POST['password']): define('POST_PASS', ''); isset($_POST['password']) ? define('POST_PASS', $_POST['password']): define('POST_PASS', '');
isset($_POST['password2']) ? define('POST_PASS2', $_POST['password2']): define('POST_PASS2', '');
if (isset($_POST['email'])) { if (isset($_POST['email'])) {
define('POST_MAIL', $_POST['email']); define('POST_MAIL', $_POST['email']);
} else if (isset($_SERVER['SSL_CLIENT_S_DN_Email'])) { } else if (isset($_SERVER['SSL_CLIENT_S_DN_Email'])) {
@ -51,6 +52,10 @@ if (POST_SUBMITTED != '') {
if (!($posteduser) || POST_PASS == '' || POST_MAIL == '') { if (!($posteduser) || POST_PASS == '' || POST_MAIL == '') {
$tplVars['error'] = T_('You <em>must</em> enter a username, password and e-mail address.'); $tplVars['error'] = T_('You <em>must</em> enter a username, password and e-mail address.');
// Check if passwords match
} elseif (POST_PASS != POST_PASS2) {
$tplVars['error'] = T_('Those passwords do not match.');
// Check if username is reserved // Check if username is reserved
} elseif ($userservice->isReserved($posteduser)) { } elseif ($userservice->isReserved($posteduser)) {
$tplVars['error'] = T_('This username has been reserved, please make another choice.'); $tplVars['error'] = T_('This username has been reserved, please make another choice.');