Check that account passwords are the same, and fail if they aren't

This commit is contained in:
nathangray 2018-11-13 15:57:20 -07:00
parent 5ca429b972
commit 924d03e7e0

View File

@ -139,6 +139,10 @@ class admin_account
$content['account_firstname'] = $content['n_given']; $content['account_firstname'] = $content['n_given'];
$content['account_lastname'] = $content['n_family']; $content['account_lastname'] = $content['n_family'];
$content['account_email'] = $content['email']; $content['account_email'] = $content['email'];
if($content['account_passwd'] && $content['account_passwd'] !== $content['account_passwd_2'])
{
throw new Api\Exception\WrongUserinput('Passwords are not the same');
}
if (!empty($content['old_account'])) if (!empty($content['old_account']))
{ {
$old = array_diff_assoc($content['old_account'], $content); $old = array_diff_assoc($content['old_account'], $content);
@ -147,6 +151,11 @@ class admin_account
{ {
$old['account_groups'] = $content['old_account']['account_groups']; $old['account_groups'] = $content['old_account']['account_groups'];
} }
if($content['account_passwd'])
{
// Don't put password into history
$old['account_passwd'] = '';
}
} }
if ($content['deny_edit'] || $old === array()) if ($content['deny_edit'] || $old === array())
{ {