add password repeat for user editing (issue #85)

This commit is contained in:
oliver 2015-04-19 11:49:29 +02:00
commit f40aea63ca
2 changed files with 11 additions and 3 deletions

View file

@ -493,7 +493,8 @@
$validation = $this->Validation->addValidationResult($validation, 'username', 'exist', true);
}
$password = $this->request->getPostParam('password');
if(!empty($password)) {
if(!empty($password))
{
$validation = $this->Validation->addValidationResults($validation,
'password',
$this->Validation->validateParam(
@ -501,6 +502,9 @@
'password'
)
);
if($password != $this->request->getPostParam('passwordrepeat')) {
$validation = $this->Validation->addValidationResult($validation, 'password', 'repeat', false);
}
}
$prename = $this->request->getPostParam('prename');
$surname = $this->request->getPostParam('surname');

View file

@ -10,8 +10,8 @@
</ul>
<h1><?=_('Edit user')?></h1>
<?php if($validation !== true) : ?>
<ul>
<?php if($validation !== true && !empty($validation)) : ?>
<ul class="validation">
<?php foreach($validation as $field => &$settings) : ?>
<li>
<ul>
@ -68,6 +68,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;
@ -99,6 +101,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')?>" 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 />
<input id="mailing" type="checkbox" name="mailing" <?php if($mailing) : ?>checked="checked"<?php endif ?> />
<label for="mailing"><?=_('Mail notifications')?></label>
</fieldset>