diff --git a/account.php b/account.php index 9d1dbcc98a3be6043f778ebf2e622ec83d7d27db..657f0983153d4c47eca69838e712812c2186b996 100644 --- a/account.php +++ b/account.php @@ -53,11 +53,12 @@ if ($user && $_POST) { elseif ($_POST) { $user_form = UserForm::getUserForm()->getForm($_POST); - $user_form->getField('email')->configure('disabled', true); - if ($thisclient) + if ($thisclient) { + $user_form->getField('email')->configure('disabled', true); $user_form->getField('email')->value = $thisclient->getEmail(); + } - if (!$user_form->isValid(function($f) { return !$f->get('internal'); })) + if (!$user_form->isValid(function($f) { return !$f->get('private'); })) $errors['err'] = 'Incomplete client information'; elseif (!$_POST['backend'] && !$_POST['passwd1']) $errors['passwd1'] = 'New password required'; @@ -76,6 +77,9 @@ elseif ($_POST) { // Users created from ClientCreateRequest elseif (isset($_POST['backend']) && !($user = User::fromVars($user_form->getClean()))) $errors['err'] = 'Unable to create local account. See messages below'; + // Registration for existing users + elseif (!$user && !$thisclient && !($user = User::fromVars($user_form->getClean()))) + $errors['err'] = 'Unable to register account. See messages below'; // New users and users registering from a ticket access link elseif (!$user && !($user = $thisclient ?: User::fromForm($user_form))) $errors['err'] = 'Unable to register account. See messages below'; diff --git a/include/class.client.php b/include/class.client.php index e8a30dd22add91cf21afd3e40ce43555bc8da167..4badbc789b3a527e43d7d4cecbe5143d77cb56a6 100644 --- a/include/class.client.php +++ b/include/class.client.php @@ -360,7 +360,7 @@ class ClientAccount extends UserAccount { $info = array('password' => $vars['passwd1']); Signal::send('auth.pwchange', $this, $info); $this->cancelResetTokens(); - $this->clearStatus(self::REQUIRE_PASSWD_RESET); + $this->clearStatus(UserAccountStatus::REQUIRE_PASSWD_RESET); } return $this->save(); diff --git a/include/class.user.php b/include/class.user.php index ac544e8f4c79bd384bc1570c8ddc177893accce9..37137177d1823c319aba4f24ef293505a843f06a 100644 --- a/include/class.user.php +++ b/include/class.user.php @@ -702,7 +702,7 @@ class UserAccount extends UserAccountModel { $vars['reset_link'] = &$vars['link']; $info = array('email' => $email, 'vars' => &$vars, 'log'=>true); - Signal::send('auth.pwreset.email', $this, $info); + Signal::send('auth.pwreset.email', $this->getUser(), $info); $msg = $ost->replaceTemplateVariables(array( 'subj' => $content->getName(),