Merge pull request #4967 from owncloud/dont_remember_login_if_enc_enabled

don't remember login if the encrypion app is enabled
This commit is contained in:
Thomas Müller 2013-09-30 10:53:41 -07:00
commit b58a464b86
4 changed files with 26 additions and 1 deletions

View File

@ -7,6 +7,7 @@
<author>Sam Tuke, Bjoern Schiessle, Florin Peter</author> <author>Sam Tuke, Bjoern Schiessle, Florin Peter</author>
<require>4</require> <require>4</require>
<shipped>true</shipped> <shipped>true</shipped>
<rememberlogin>false</rememberlogin>
<types> <types>
<filesystem/> <filesystem/>
</types> </types>

View File

@ -32,9 +32,10 @@
<?php p($l->t('Lost your password?')); ?> <?php p($l->t('Lost your password?')); ?>
</a> </a>
<?php endif; ?> <?php endif; ?>
<?php if ($_['rememberLoginAllowed'] === true) : ?>
<input type="checkbox" name="remember_login" value="1" id="remember_login" checked /> <input type="checkbox" name="remember_login" value="1" id="remember_login" checked />
<label for="remember_login"><?php p($l->t('remember')); ?></label> <label for="remember_login"><?php p($l->t('remember')); ?></label>
<?php endif; ?>
<input type="hidden" name="timezone-offset" id="timezone-offset"/> <input type="hidden" name="timezone-offset" id="timezone-offset"/>
<input type="submit" id="submit" class="login primary" value="<?php p($l->t('Log in')); ?>"/> <input type="submit" id="submit" class="login primary" value="<?php p($l->t('Log in')); ?>"/>
</fieldset> </fieldset>

View File

@ -770,6 +770,7 @@ class OC {
|| !isset($_COOKIE["oc_token"]) || !isset($_COOKIE["oc_token"])
|| !isset($_COOKIE["oc_username"]) || !isset($_COOKIE["oc_username"])
|| !$_COOKIE["oc_remember_login"] || !$_COOKIE["oc_remember_login"]
|| !OC_Util::rememberLoginAllowed()
) { ) {
return false; return false;
} }

View File

@ -471,6 +471,7 @@ class OC_Util {
} }
$parameters['alt_login'] = OC_App::getAlternativeLogIns(); $parameters['alt_login'] = OC_App::getAlternativeLogIns();
$parameters['rememberLoginAllowed'] = self::rememberLoginAllowed();
OC_Template::printGuestPage("", "login", $parameters); OC_Template::printGuestPage("", "login", $parameters);
} }
@ -512,6 +513,27 @@ class OC_Util {
} }
} }
/**
* Check if it is allowed to remember login.
*
* @note Every app can set 'rememberlogin' to 'false' to disable the remember login feature
*
* @return bool
*/
public static function rememberLoginAllowed() {
$apps = OC_App::getEnabledApps();
foreach ($apps as $app) {
$appInfo = OC_App::getAppInfo($app);
if (isset($appInfo['rememberlogin']) && $appInfo['rememberlogin'] === 'false') {
return false;
}
}
return true;
}
/** /**
* @brief Check if the user is a subadmin, redirects to home if not * @brief Check if the user is a subadmin, redirects to home if not
* @return array $groups where the current user is subadmin * @return array $groups where the current user is subadmin