Fix encryption + remembered login due to missing login hook
The encryption app relies on the post_login hook to initialize its keys. Since we do not emit it on a remembered login, the keys were always un- initialized and the user was asked to log out and in again. This patch *translates* the postRememberedLogin hook to a post_login hook. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
parent
e920e20284
commit
0a43c259c4
|
@ -361,6 +361,10 @@ class Server extends ServerContainer implements IServerContainer {
|
||||||
/** @var $user \OC\User\User */
|
/** @var $user \OC\User\User */
|
||||||
\OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password));
|
\OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password));
|
||||||
});
|
});
|
||||||
|
$userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) {
|
||||||
|
/** @var $user \OC\User\User */
|
||||||
|
\OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password));
|
||||||
|
});
|
||||||
$userSession->listen('\OC\User', 'logout', function () {
|
$userSession->listen('\OC\User', 'logout', function () {
|
||||||
\OC_Hook::emit('OC_User', 'logout', array());
|
\OC_Hook::emit('OC_User', 'logout', array());
|
||||||
});
|
});
|
||||||
|
|
|
@ -792,7 +792,13 @@ class Session implements IUserSession, Emitter {
|
||||||
$this->setToken($token->getId());
|
$this->setToken($token->getId());
|
||||||
$this->lockdownManager->setToken($token);
|
$this->lockdownManager->setToken($token);
|
||||||
$user->updateLastLoginTimestamp();
|
$user->updateLastLoginTimestamp();
|
||||||
$this->manager->emit('\OC\User', 'postRememberedLogin', [$user]);
|
$password = null;
|
||||||
|
try {
|
||||||
|
$password = $this->tokenProvider->getPassword($token, $sessionId);
|
||||||
|
} catch (PasswordlessTokenException $ex) {
|
||||||
|
// Ignore
|
||||||
|
}
|
||||||
|
$this->manager->emit('\OC\User', 'postRememberedLogin', [$user, $password]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue