Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2016-09-02 18:02:47 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2017-02-22 23:25:28 +0300
commit4a8114709092a27b7e511bdb2f3d2903ab3df201 (patch)
treeb247bbdeec98bc762a1e916c05f8bf6f22f25b66 /lib/AppInfo
parent03573e2bb00995372210fda9ddbfef578f2a6a2b (diff)
create a dynamic default account
Diffstat (limited to 'lib/AppInfo')
-rw-r--r--lib/AppInfo/Application.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index 637f59cd9..0b56e37ba 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -22,6 +22,7 @@
namespace OCA\Mail\AppInfo;
+use OC;
use OCA\Mail\Contracts\IMailManager;
use OCA\Mail\Service\MailManager;
use OCP\AppFramework\App;
@@ -32,6 +33,11 @@ class Application extends App {
public function __construct(array $urlParams = []) {
parent::__construct('mail', $urlParams);
+ $this->initializeAppContainer();
+ $this->registerHooks();
+ }
+
+ public function initializeAppContainer() {
$container = $this->getContainer();
$transport = $container->getServer()->getConfig()->getSystemValue('app.mail.transport', 'smtp');
@@ -48,8 +54,25 @@ class Application extends App {
return $container->getServer()->getUserFolder($user);
});
$container->registerParameter("testSmtp", $testSmtp);
- $container->registerParameter("referrer", isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null);
+ $container->registerParameter("referrer", isset($_SERVER['HTTP_REFERER']) ? : null);
$container->registerParameter("hostname", Util::getServerHostName());
}
+ public function registerHooks() {
+ Util::connectHook('OC_User', 'post_login', $this, 'handleLoginHook');
+ }
+
+ public function handleLoginHook($params) {
+ if (!isset($params['password'])) {
+ return;
+ }
+ $password = $params['password'];
+
+ $container = $this->getContainer();
+ /* @var $defaultAccountManager \OCA\Mail\Service\DefaultAccount\DefaultAccountManager */
+ $defaultAccountManager = $container->query('\OCA\Mail\Service\DefaultAccount\DefaultAccountManager');
+
+ $defaultAccountManager->saveLoginPassword($password);
+ }
+
}