Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117743875
D5872.1775169017.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D5872.1775169017.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 2, 10:30 PM (18 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18821256
Default Alt Text
D5872.1775169017.diff (2 KB)
Attached To
Mode
D5872: Fix loading of kolab_2fa plugin by kolab plugin
Attached
Detach File
Event Timeline