Skip to content
Snippets Groups Projects
Commit ce603995 authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #788 from greezybacon/issue/registration-existing-user


oops: Fixup registration for existing users

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents a7d657f2 21b8dfee
No related branches found
No related tags found
No related merge requests found
......@@ -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';
......
......@@ -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();
......
......@@ -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(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment