Commit ea0bdd04 authored by Franco Fichtner's avatar Franco Fichtner

system: do not prompt for password on user edit

PR: https://lists.opnsense.org/pipermail/users/2017-March/000062.html
(cherry picked from commit a2381e6c)
parent 10b23cf3
...@@ -235,10 +235,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -235,10 +235,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$input_errors[] = gettext('Cannot set random password due to explicit input.'); $input_errors[] = gettext('Cannot set random password due to explicit input.');
} }
if (empty($pconfig['passwordfld1']) && empty($pconfig['gen_new_password'])) {
$input_errors[] = gettext('A password is required.');
}
if (!empty($pconfig['disabled']) && $_SESSION['Username'] === $a_user[$id]['name']) { if (!empty($pconfig['disabled']) && $_SESSION['Username'] === $a_user[$id]['name']) {
$input_errors[] = gettext('You cannot disable yourself.'); $input_errors[] = gettext('You cannot disable yourself.');
} }
...@@ -246,8 +242,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -246,8 +242,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (isset($id)) { if (isset($id)) {
$oldusername = $a_user[$id]['name']; $oldusername = $a_user[$id]['name'];
} else { } else {
$oldusername = ""; $oldusername = '';
if (empty($pconfig['passwordfld1']) && empty($pconfig['gen_new_password'])) {
$input_errors[] = gettext('A password is required.');
}
} }
/* make sure this user name is unique */ /* make sure this user name is unique */
if (count($input_errors) == 0) { if (count($input_errors) == 0) {
foreach ($a_user as $userent) { foreach ($a_user as $userent) {
...@@ -257,6 +258,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -257,6 +258,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} }
} }
} }
/* also make sure it is not reserved */ /* also make sure it is not reserved */
if (count($input_errors) == 0) { if (count($input_errors) == 0) {
$system_users = explode("\n", file_get_contents("/etc/passwd")); $system_users = explode("\n", file_get_contents("/etc/passwd"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment