summaryrefslogtreecommitdiffstats
path: root/lib/private/user
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2014-12-04 16:48:07 +0100
committerMorris Jobke <hey@morrisjobke.de>2014-12-08 22:42:37 +0100
commit0d4f0ab87182cf2cb588bd3285fe41b46f26ee4d (patch)
tree68ee815c2f06e4f6ef049d56f65fdbf2cf8c4d18 /lib/private/user
parent2d5fc9c1a6beec15f04277ccf1408b17f04631e9 (diff)
downloadnextcloud-server-0d4f0ab87182cf2cb588bd3285fe41b46f26ee4d.tar.gz
nextcloud-server-0d4f0ab87182cf2cb588bd3285fe41b46f26ee4d.zip
reduce OC_Preferences, OC_Config and \OCP\Config usage
* files_encryption * files_versions * files_trashbin * tests * status.php * core * server container
Diffstat (limited to 'lib/private/user')
-rw-r--r--lib/private/user/session.php6
-rw-r--r--lib/private/user/user.php7
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/private/user/session.php b/lib/private/user/session.php
index 94abaca3e76..277aa1a047e 100644
--- a/lib/private/user/session.php
+++ b/lib/private/user/session.php
@@ -211,15 +211,15 @@ class Session implements IUserSession, Emitter {
}
// get stored tokens
- $tokens = \OC_Preferences::getKeys($uid, 'login_token');
+ $tokens = \OC::$server->getConfig()->getUserKeys($uid, 'login_token');
// test cookies token against stored tokens
if (!in_array($currentToken, $tokens, true)) {
return false;
}
// replace successfully used token with a new one
- \OC_Preferences::deleteKey($uid, 'login_token', $currentToken);
+ \OC::$server->getConfig()->deleteUserValue($uid, 'login_token', $currentToken);
$newToken = \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate(32);
- \OC_Preferences::setValue($uid, 'login_token', $newToken, time());
+ \OC::$server->getConfig()->setUserValue($uid, 'login_token', $newToken, time());
$this->setMagicInCookie($user->getUID(), $newToken);
//login
diff --git a/lib/private/user/user.php b/lib/private/user/user.php
index fb66f893c61..00ded84f955 100644
--- a/lib/private/user/user.php
+++ b/lib/private/user/user.php
@@ -68,10 +68,11 @@ class User implements IUser {
if ($this->config) {
$enabled = $this->config->getUserValue($uid, 'core', 'enabled', 'true');
$this->enabled = ($enabled === 'true');
+ $this->lastLogin = $this->config->getUserValue($uid, 'login', 'lastLogin', 0);
} else {
$this->enabled = true;
+ $this->lastLogin = \OC::$server->getConfig()->getUserValue($uid, 'login', 'lastLogin', 0);
}
- $this->lastLogin = \OC_Preferences::getValue($uid, 'login', 'lastLogin', 0);
}
/**
@@ -140,7 +141,7 @@ class User implements IUser {
*/
public function updateLastLoginTimestamp() {
$this->lastLogin = time();
- \OC_Preferences::setValue(
+ \OC::$server->getConfig()->setUserValue(
$this->uid, 'login', 'lastLogin', $this->lastLogin);
}
@@ -163,7 +164,7 @@ class User implements IUser {
\OC_Group::removeFromGroup($this->uid, $i);
}
// Delete the user's keys in preferences
- \OC_Preferences::deleteUser($this->uid);
+ \OC::$server->getConfig()->deleteAllUserValues($this->uid);
// Delete user files in /data/
\OC_Helper::rmdirr(\OC_User::getHome($this->uid));