From 0006dd877768edb571606498cb094df79912e2b4 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Wed, 12 Aug 2015 13:22:25 -0500 Subject: [PATCH] users: Fix password reset dialogs --- include/class.client.php | 5 +++++ include/class.page.php | 7 +------ include/class.user.php | 16 +++++++--------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/include/class.client.php b/include/class.client.php index 32e2dab21..4cb9fc1f9 100644 --- a/include/class.client.php +++ b/include/class.client.php @@ -362,6 +362,11 @@ class ClientAccount extends UserAccount { function update($vars, &$errors) { global $cfg; + // FIXME: Updates by agents should go through UserAccount::update() + global $thisstaff; + if ($thisstaff) + return parent::update($vars, $errors); + $rtoken = $_SESSION['_client']['reset-token']; if ($vars['passwd1'] || $vars['passwd2'] || $vars['cpasswd'] || $rtoken) { diff --git a/include/class.page.php b/include/class.page.php index 0373780e4..fa0eb8f77 100644 --- a/include/class.page.php +++ b/include/class.page.php @@ -217,8 +217,6 @@ class Page extends VerySimpleModel { try { $qs = self::objects()->filter(array('name'=>$name)) ->values_flat('id'); - if ($lang) - $qs = $qs->filter(array('lang'=>$lang)); list($id) = $qs->one(); return $id; } @@ -234,10 +232,7 @@ class Page extends VerySimpleModel { static function lookupByType($type, $lang=false) { try { - $qs = self::objects()->filter(array('type'=>$type)); - if ($lang) - $qs = $qs->filter(array('lang'=>$lang)); - return $qs->one(); + return self::objects()->filter(array('type'=>$type))->one(); } catch (DoesNotExist $ex) { return null; diff --git a/include/class.user.php b/include/class.user.php index b3423a871..4fcb2c3ce 100644 --- a/include/class.user.php +++ b/include/class.user.php @@ -882,12 +882,14 @@ class UserAccount extends VerySimpleModel { var $_status; var $_extra; - function __onload() { - $this->_status = new UserAccountStatus($this->get('status')); + function getStatus() { + if (!isset($this->_status)) + $this->_status = new UserAccountStatus($this->get('status')); + return $this->_status; } protected function hasStatus($flag) { - return $this->_status->check($flag); + return $this->getStatus()->check($flag); } protected function clearStatus($flag) { @@ -904,7 +906,7 @@ class UserAccount extends VerySimpleModel { } function isConfirmed() { - return $this->_status->isConfirmed(); + return $this->getStatus()->isConfirmed(); } function lock() { @@ -918,7 +920,7 @@ class UserAccount extends VerySimpleModel { } function isLocked() { - return $this->_status->isLocked(); + return $this->getStatus()->isLocked(); } function forcePasswdReset() { @@ -934,10 +936,6 @@ class UserAccount extends VerySimpleModel { return !$this->hasStatus(UserAccountStatus::FORBID_PASSWD_RESET); } - function getStatus() { - return $this->_status; - } - function getInfo() { return $this->ht; } -- GitLab