add password repeat for user creation (issue #85)

This commit is contained in:
oliver 2015-04-19 11:45:52 +02:00
commit 32577da462
2 changed files with 10 additions and 2 deletions

View file

@ -414,6 +414,10 @@
if($this->Users->emailExists($email)) {
$validation = $this->Validation->addValidationResult($validation, 'email', 'exist', true);
}
$password = $this->request->getPostParam('password');
if($password != $this->request->getPostParam('passwordrepeat')) {
$validation = $this->Validation->addValidationResult($validation, 'password', 'repeat', false);
}
// Create
if($validation === true)

View file

@ -6,8 +6,8 @@
</ul>
<h1><?=_('New user')?></h1>
<?php if($validation !== true) : ?>
<ul>
<?php if($validation !== true && !empty($validation)) : ?>
<ul class="validation">
<?php foreach($validation as $field => &$settings) : ?>
<li>
<ul>
@ -64,6 +64,8 @@
break;
case 'maxlength': printf(_('Password is too long (max. %d chars)'), $value);
break;
case 'repeat': printf(_('Passwords does not match'));
break;
default: echo _('Password invalid');
}
break;
@ -91,6 +93,8 @@
<input name="email" type="email" placeholder="<?=_('Email address')?>" title="<?=_('Email address')?>" required="required" value="<?=$email?>" <?=(array_key_exists('email', $validation)) ? 'class="invalid"' : null?> /><br />
<label for="password"><?=_('Password')?>:</label>
<input name="password" type="password" placeholder="<?=_('Password')?>" title="<?=_('Password')?>" required="required" maxlength="<?=$validationSettings['password']['maxlength']?>" <?=(array_key_exists('password', $validation)) ? 'class="invalid"' : null?> /><br />
<label for="passwordrepeat"><?=_('Repeat password')?>:</label>
<input name="passwordrepeat" type="password" placeholder="<?=_('Password')?>" title="<?=_('Password')?>" required="required" maxlength="<?=$validationSettings['password']['maxlength']?>" <?=(array_key_exists('password', $validation)) ? 'class="invalid"' : null?> /><br />
</fieldset>
</fieldset>
<input type="submit" name="create" value="<?=_('create')?>" />