diff --git a/rainloop/admin.php b/rainloop/admin.php index ff67530a..57cc3043 100755 --- a/rainloop/admin.php +++ b/rainloop/admin.php @@ -15,4 +15,5 @@ $oTemplate = new OCP\Template('rainloop', 'admin-local'); $oTemplate->assign('rainloop-admin-panel-link', OC_RainLoop_Helper::getAppUrl().'?admin'); $oTemplate->assign('rainloop-autologin', \OC::$server->getConfig()->getAppValue('rainloop', 'rainloop-autologin', false)); +$oTemplate->assign('rainloop-autologin-with-email', \OC::$server->getConfig()->getAppValue('rainloop', 'rainloop-autologin-with-email', false)); return $oTemplate->fetchPage(); diff --git a/rainloop/ajax/admin.php b/rainloop/ajax/admin.php index 588136de..70e90b43 100755 --- a/rainloop/ajax/admin.php +++ b/rainloop/ajax/admin.php @@ -20,6 +20,8 @@ { \OC::$server->getConfig()->setAppValue('rainloop', 'rainloop-autologin', isset($_POST['rainloop-autologin']) ? '1' === $_POST['rainloop-autologin'] : false); + \OC::$server->getConfig()->setAppValue('rainloop', 'rainloop-autologin-with-email', isset($_POST['rainloop-autologin']) ? + '2' === $_POST['rainloop-autologin'] : false); $bAutologin = \OC::$server->getConfig()->getAppValue('rainloop', 'rainloop-autologin', false); } diff --git a/rainloop/app.php b/rainloop/app.php index 31390325..4ab70ee8 100755 --- a/rainloop/app.php +++ b/rainloop/app.php @@ -36,19 +36,28 @@ $sEncodedPassword = ''; $sUser = OCP\User::getUser(); + $sPasswordSalt = ''; if (\OC::$server->getConfig()->getAppValue('rainloop', 'rainloop-autologin', false)) { $sEmail = $sUser; + $sPasswordSalt = $sUser; + $sEncodedPassword = \OC::$server->getConfig()->getUserValue($sUser, 'rainloop', 'rainloop-autologin-password', ''); + } + else if (\OC::$server->getConfig()->getAppValue('rainloop', 'rainloop-autologin-with-email', false)) + { + $sEmail = \OC::$server->getConfig()->getUserValue($sUser, 'settings', 'email',''); + $sPasswordSalt = $sUser; $sEncodedPassword = \OC::$server->getConfig()->getUserValue($sUser, 'rainloop', 'rainloop-autologin-password', ''); } else { $sEmail = \OC::$server->getConfig()->getUserValue($sUser, 'rainloop', 'rainloop-email', ''); + $sPasswordSalt = $sEmail; $sEncodedPassword = \OC::$server->getConfig()->getUserValue($sUser, 'rainloop', 'rainloop-password', ''); } - $sDecodedPassword = OC_RainLoop_Helper::decodePassword($sEncodedPassword, md5($sEmail)); + $sDecodedPassword = OC_RainLoop_Helper::decodePassword($sEncodedPassword, md5($sPasswordSalt)); $_ENV['___rainloop_owncloud_email'] = $sEmail; $_ENV['___rainloop_owncloud_password'] = $sDecodedPassword; diff --git a/rainloop/appinfo/app.php b/rainloop/appinfo/app.php old mode 100755 new mode 100644 index cd21ed0d..496c3a68 --- a/rainloop/appinfo/app.php +++ b/rainloop/appinfo/app.php @@ -13,7 +13,7 @@ OCP\App::registerAdmin('rainloop', 'admin'); OCP\App::registerPersonal('rainloop', 'personal'); -if (\OC::$server->getConfig()->getAppValue('rainloop', 'rainloop-autologin', false)) +if (\OC::$server->getConfig()->getAppValue('rainloop', 'rainloop-autologin', false) || \OC::$server->getConfig()->getAppValue('rainloop', 'rainloop-autologin-with-email', false)) { OCP\Util::connectHook('OC_User', 'post_login', 'OC_RainLoop_Helper', 'login'); OCP\Util::connectHook('OC_User', 'post_setPassword', 'OC_RainLoop_Helper', 'changePassword'); diff --git a/rainloop/templates/admin-local.php b/rainloop/templates/admin-local.php index 67bba5ec..1bbf1f7a 100755 --- a/rainloop/templates/admin-local.php +++ b/rainloop/templates/admin-local.php @@ -14,13 +14,25 @@
+
+