introduce OC_Util::rememberLoginAllowed()
This commit is contained in:
parent
b693b5085c
commit
c486fc7608
|
@ -32,7 +32,7 @@
|
||||||
<?php p($l->t('Lost your password?')); ?>
|
<?php p($l->t('Lost your password?')); ?>
|
||||||
</a>
|
</a>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if ($_['encryption_enabled'] === false) : ?>
|
<?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; ?>
|
<?php endif; ?>
|
||||||
|
|
|
@ -760,7 +760,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_App::isEnabled('files_encryption')
|
|| !OC_Util::rememberLoginAllowed()
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
13
lib/util.php
13
lib/util.php
|
@ -467,7 +467,7 @@ class OC_Util {
|
||||||
}
|
}
|
||||||
|
|
||||||
$parameters['alt_login'] = OC_App::getAlternativeLogIns();
|
$parameters['alt_login'] = OC_App::getAlternativeLogIns();
|
||||||
$parameters['encryption_enabled'] = OC_App::isEnabled('files_encryption');
|
$parameters['rememberLoginAllowed'] = self::rememberLoginAllowed();
|
||||||
OC_Template::printGuestPage("", "login", $parameters);
|
OC_Template::printGuestPage("", "login", $parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -509,6 +509,17 @@ class OC_Util {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if it is allowed to remember login.
|
||||||
|
* E.g. if encryption is enabled the user needs to log-in every time he visites
|
||||||
|
* ownCloud in order to decrypt the private key.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function rememberLoginAllowed() {
|
||||||
|
return !OC_App::isEnabled('files_encryption');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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
|
||||||
|
|
Loading…
Reference in New Issue