Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable10] First time login was not properly handled by \OC\User\Sess… #34758

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/private/User/Session.php
Expand Up @@ -977,7 +977,7 @@ public function tryAuthModuleLogin(IRequest $request) {
* @return boolean True if the user can be authenticated, false otherwise
* @throws LoginException if an app canceled the login process or the user is not enabled
*/
protected function loginUser(IUser $user = null, $password) {
public function loginUser(IUser $user = null, $password) {
$uid = $user === null ? '' : $user->getUID();
return $this->emittingCall(function () use (&$user, &$password) {
if ($user === null) {
Expand All @@ -996,12 +996,12 @@ protected function loginUser(IUser $user = null, $password) {

$this->setUser($user);
$this->setLoginName($user->getDisplayName());
$user->updateLastLoginTimestamp();
$firstTimeLogin = $user->updateLastLoginTimestamp();

$this->manager->emit('\OC\User', 'postLogin', [$user, $password]);

if ($this->isLoggedIn()) {
$this->prepareUserLogin(false);
$this->prepareUserLogin($firstTimeLogin);
} else {
$message = \OC::$server->getL10N('lib')->t('Login canceled by app');
throw new LoginException($message);
Expand Down Expand Up @@ -1110,7 +1110,7 @@ public function unsetMagicInCookie() {
$secureCookie = OC::$server->getRequest()->getServerProtocol() === 'https';

unset($_COOKIE['oc_username'], $_COOKIE['oc_token'], $_COOKIE['oc_remember_login']); //TODO: DI

\setcookie('oc_username', '', \time() - 3600, OC::$WEBROOT, '', $secureCookie, true);
\setcookie('oc_token', '', \time() - 3600, OC::$WEBROOT, '', $secureCookie, true);
\setcookie('oc_remember_login', '', \time() - 3600, OC::$WEBROOT, '', $secureCookie, true);
Expand Down