Page MenuHomePhorge

D5872.1775178383.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D5872.1775178383.diff

diff --git a/plugins/kolab/Kolab/Configuration.php b/plugins/kolab/Kolab/Configuration.php
--- a/plugins/kolab/Kolab/Configuration.php
+++ b/plugins/kolab/Kolab/Configuration.php
@@ -7,6 +7,8 @@
*/
class Configuration extends Feature
{
+ private $done = false;
+
/**
* Feature initialization
*/
@@ -14,6 +16,7 @@
{
$this->plugin->add_hook('startup', [$this, 'startupHook']);
$this->plugin->add_hook('ready', [$this, 'readyHook']);
+ $this->plugin->add_hook('authenticate', [$this, 'authenticateHook']);
}
/**
@@ -60,6 +63,11 @@
if (!$this->rc->plugins->get_plugin($plugin)) {
$this->rc->plugins->load_plugin($plugin);
+
+ // @phpstan-ignore-next-line
+ if ($plugin == 'kolab_2fa' && ($kolab_2fa = $this->rc->plugins->get_plugin($plugin))) {
+ $kolab_2fa->startup(['task' => $this->rc->task ?? '', 'action' => $this->rc->action ?? '']);
+ }
}
}
@@ -146,6 +154,24 @@
}
}
+ /**
+ * Authentication hook handler
+ */
+ public function authenticateHook($args): array
+ {
+ // Startup handler is not enough to properly load kolab_2fa plugin
+ // for webmail logon page
+ if (defined('RCMAIL_START') && empty($args['abort'])
+ && empty($args['sso']) && $args['user'] !== '' && $args['pass'] !== ''
+ ) {
+ $this->rc->user = $args['user'];
+ $this->rc->password = $args['pass'];
+ $this->applyConfiguration($this->getConfig());
+ }
+
+ return $args;
+ }
+
/**
* Startup hook handler
*/
@@ -153,7 +179,7 @@
{
// For Kolab Syncroton we have to use the 'ready' hook.
if ($args['task'] != 'syncroton') {
- $this->applyConfiguration(Client::getMyConfig());
+ $this->applyConfiguration($this->getConfig());
}
return $args;
@@ -167,9 +193,22 @@
// For Kolab Syncroton we have to use the 'ready' hook. In 'startup' hook
// user is not yet authenticated.
if ($args['task'] == 'syncroton') {
- $this->applyConfiguration(Client::getMyConfig());
+ $this->applyConfiguration($this->getConfig());
}
return $args;
}
+
+ private function getConfig(): array
+ {
+ if ($this->done) {
+ return [];
+ }
+
+ $config = Client::getMyConfig();
+
+ $this->done = !empty($config);
+
+ return $config;
+ }
}

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 3, 1:06 AM (21 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18821256
Default Alt Text
D5872.1775178383.diff (2 KB)

Event Timeline