mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 07:35:55 +08:00
Better intergrate with Nextcloud #96
This commit is contained in:
parent
46556931cc
commit
c63366d0dc
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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')) {
|
||||
|
|
Loading…
Reference in a new issue