diff --git a/integrations/nextcloud/snappymail/css/embed.css b/integrations/nextcloud/snappymail/css/embed.css index 4d1a9bf82..fd3592dbe 100644 --- a/integrations/nextcloud/snappymail/css/embed.css +++ b/integrations/nextcloud/snappymail/css/embed.css @@ -30,7 +30,8 @@ Then the below #rl-app can be used to style it. #content[class*="app-"] #rl-app .select, #content[class*="app-"] #rl-app textarea, #content[class*="app-"] #rl-app input, -#content[class*="app-"] #rl-app .input-block-level +#content[class*="app-"] #rl-app .input-block-level, +#content[class*="app-"] #rl-app .icon-spinner { box-sizing: border-box; } @@ -38,3 +39,28 @@ Then the below #rl-app can be used to style it. min-width: 100%; min-height: 100%; } + +#rl-app select, +#rl-app input +{ + min-height: auto; + height: auto; + margin: 0; + padding: 3px; +} +#rl-app .form-horizontal .control-group > :not(label) +{ + margin-left: 20px; +} +#rl-app .LoginView .fontastic + input { + padding-left: 30px; +} + +@media print { + #body-user #header { + display: none; + } + #content { + padding-top: 0; + } +} diff --git a/integrations/nextcloud/snappymail/lib/AppInfo/Application.php b/integrations/nextcloud/snappymail/lib/AppInfo/Application.php index 629c72062..e830a7df8 100644 --- a/integrations/nextcloud/snappymail/lib/AppInfo/Application.php +++ b/integrations/nextcloud/snappymail/lib/AppInfo/Application.php @@ -23,13 +23,35 @@ class Application extends App implements IBootstrap public function boot(IBootContext $context): void { $this->registerNavigation(); - $this->getContainer()->query('SnappyMailHelper')->registerHooks(); + + $userSession = \OC::$server->getUserSession(); + $userSession->listen('\OC\User', 'postLogin', function($user, $loginName, $password, $isTokenLogin) { + $config = \OC::$server->getConfig(); + $sEmail = ''; + // Only store the user's password in the current session if they have + // enabled auto-login using Nextcloud username or email address. + if ($config->getAppValue('snappymail', 'snappymail-autologin', false)) { + $sEmail = $user->getUID(); + } else if ($config->getAppValue('snappymail', 'snappymail-autologin-with-email', false)) { + $sEmail = $config->getUserValue($user->getUID(), 'settings', 'email', ''); + } + if ($sEmail) { + SnappyMailHelper::startApp(true); + \OC::$server->getSession()['snappymail-sso-hash'] = \RainLoop\Api::CreateUserSsoHash($sEmail, $password/*, array $aAdditionalOptions = array(), bool $bUseTimeout = true*/); + } + }); + + $userSession->listen('\OC\User', 'logout', function($user) { + \OC::$server->getSession()['snappymail-sso-hash'] = ''; + SnappyMailHelper::startApp(true); + \RainLoop\Api::LogoutCurrentLogginedUser(); + }); } // public function __construct(string $appName, array $urlParams = []) public function __construct() { - parent::__construct('snappymail', $urlParams); + parent::__construct('snappymail'); $container = $this->getContainer(); diff --git a/integrations/nextcloud/snappymail/lib/Util/SnappyMailHelper.php b/integrations/nextcloud/snappymail/lib/Util/SnappyMailHelper.php index ea4832c8c..fa10fc967 100644 --- a/integrations/nextcloud/snappymail/lib/Util/SnappyMailHelper.php +++ b/integrations/nextcloud/snappymail/lib/Util/SnappyMailHelper.php @@ -5,32 +5,6 @@ namespace OCA\SnappyMail\Util; class SnappyMailHelper { - public function registerHooks() - { - $userSession = \OC::$server->getUserSession(); - $userSession->listen('\OC\User', 'postLogin', function($user, $loginName, $password, $isTokenLogin) { - $config = \OC::$server->getConfig(); - $sEmail = ''; - // Only store the user's password in the current session if they have - // enabled auto-login using Nextcloud username or email address. - if ($config->getAppValue('snappymail', 'snappymail-autologin', false)) { - $sEmail = $user->getUID(); - } else if ($config->getAppValue('snappymail', 'snappymail-autologin-with-email', false)) { - $sEmail = $config->getUserValue($user->getUID(), 'settings', 'email', ''); - } - if ($sEmail) { - static::startApp(true); - \OC::$server->getSession()['snappymail-sso-hash'] = \RainLoop\Api::CreateUserSsoHash($sEmail, $password/*, array $aAdditionalOptions = array(), bool $bUseTimeout = true*/); - } - }); - - $userSession->listen('\OC\User', 'logout', function($user) { - \OC::$server->getSession()['snappymail-sso-hash'] = ''; - static::startApp(true); - \RainLoop\Api::LogoutCurrentLogginedUser(); - }); - } - public static function startApp(bool $api = false) { if (!\class_exists('RainLoop\\Api')) {