diff --git a/include/class.auth.php b/include/class.auth.php index d778401d9c4692b518b5d7f9d87585bdde1d6937..31459cd01d734b8d8bca1b70a913d5d150aeafe4 100644 --- a/include/class.auth.php +++ b/include/class.auth.php @@ -492,6 +492,14 @@ abstract class UserAuthenticationBackend extends AuthenticationBackend { return $user; } + + protected function validate($username) { + if (!($acct = ClientAccount::lookupByUsername($username))) + return; + + if (($client = new ClientSession(new EndUser($acct->getUser()))) && $client->getId()) + return $client; + } } /** @@ -861,18 +869,11 @@ class osTicketClientAuthentication extends UserAuthenticationBackend { return; if (($client = new ClientSession(new EndUser($acct->getUser()))) - && $client->getId() - && $acct->checkPassword($password) - ) { - return $client; - } - } - - protected function validate($username) { - if (!($acct = ClientAccount::lookupByUsername($username))) - return; - - if (($client = new ClientSession(new EndUser($acct->getUser()))) && $client->getId()) + && !$client->getId()) + return false; + elseif (!$acct->checkPassword($password)) + return false; + else return $client; } } @@ -913,14 +914,6 @@ class ClientPasswordResetTokenBackend extends UserAuthenticationBackend { Signal::send('auth.pwreset.login', $client); return parent::login($client, $bk); } - - protected function validate($authkey) { - if (!($acct = ClientAccount::lookupByUsername($authkey))) - return; - - if (($client = new ClientSession(new EndUser($acct->getUser()))) && $client->getId()) - return $client; - } } UserAuthenticationBackend::register('ClientPasswordResetTokenBackend'); @@ -948,14 +941,6 @@ class ClientAcctConfirmationTokenBackend extends UserAuthenticationBackend { else return $client; } - - protected function validate($authkey) { - if (!($acct = ClientAccount::lookupByUsername($authkey))) - return; - - if (($client = new ClientSession(new EndUser($acct->getUser()))) && $client->getId()) - return $client; - } } UserAuthenticationBackend::register('ClientAcctConfirmationTokenBackend'); ?> diff --git a/include/class.forms.php b/include/class.forms.php index 7a43ddd961db2b3ba4a02483722420b739ed1564..5955ec76d375ccfb37e32ad23efc61a6b1477c3b 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -1097,6 +1097,8 @@ class CheckboxWidget extends Widget { function render() { $config = $this->field->getConfiguration(); + if (!isset($this->value)) + $this->value = $this->field->get('default'); ?> <input type="checkbox" name="<?php echo $this->name; ?>[]" <?php if ($this->value) echo 'checked="checked"'; ?> value="<?php