Skip to content

docs(config): clarify remember_login_cookie_lifetime behavior and scope#58792

Open
joshtrichards wants to merge 2 commits intomasterfrom
jtr/docs-config-remember-login-entry
Open

docs(config): clarify remember_login_cookie_lifetime behavior and scope#58792
joshtrichards wants to merge 2 commits intomasterfrom
jtr/docs-config-remember-login-entry

Conversation

@joshtrichards
Copy link
Copy Markdown
Member

@joshtrichards joshtrichards commented Mar 8, 2026

  • Resolves: #

Summary

🧹 of the remember_login_cookie_lifetime config entry description.

Related PR: #58794

TODO

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

…cope

Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards joshtrichards added this to the Nextcloud 34 milestone Mar 8, 2026
@joshtrichards joshtrichards requested a review from a team as a code owner March 8, 2026 17:30
@joshtrichards joshtrichards requested review from leftybournes and salmart-dev and removed request for a team March 8, 2026 17:30
@joshtrichards joshtrichards added the 3. to review Waiting for reviews label Mar 8, 2026
Signed-off-by: Josh <josh.t.richards@gmail.com>
Comment on lines +346 to +347
* expiration of remembered login tokens. Therefore, changing or clearing cookies
* alone may not fully reset remembered login state.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clearing the cookie in the browser? How could that not log you out?

I feel like you dived into the rememberme effects and know more than me, but what I’m reading in these two PR is confusing 🙈

Copy link
Copy Markdown
Member Author

@joshtrichards joshtrichards Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went back and forth on how to document this. I wanted to leave out server-side implementation details since the audience is meant to be more admin-oriented, but I also wanted to keep it honest just in case there were some weird side effects that might impact admin-level troubleshooting. Clearing the cookies from the browser will effectively result in clearing things, but - technically - the server-side storage of the remember-me session token will still stick around until the server-side piece happens:

public function invalidateOldTokens() {
$olderThan = $this->time->getTime() - $this->config->getSystemValueInt('session_lifetime', 60 * 60 * 24);
$this->logger->debug('Invalidating session tokens older than ' . date('c', $olderThan), ['app' => 'cron']);
$this->mapper->invalidateOld($olderThan, OCPIToken::TEMPORARY_TOKEN, OCPIToken::DO_NOT_REMEMBER);
$rememberThreshold = $this->time->getTime() - $this->config->getSystemValueInt('remember_login_cookie_lifetime', 60 * 60 * 24 * 15);
$this->logger->debug('Invalidating remembered session tokens older than ' . date('c', $rememberThreshold), ['app' => 'cron']);
$this->mapper->invalidateOld($rememberThreshold, OCPIToken::TEMPORARY_TOKEN, OCPIToken::REMEMBER);
$wipeThreshold = $this->time->getTime() - $this->config->getSystemValueInt('token_auth_wipe_token_retention', 60 * 60 * 24 * 60);
$this->logger->debug('Invalidating auth tokens marked for remote wipe older than ' . date('c', $wipeThreshold), ['app' => 'cron']);
$this->mapper->invalidateOld($wipeThreshold, OCPIToken::WIPE_TOKEN);
$authTokenThreshold = $this->time->getTime() - $this->config->getSystemValueInt('token_auth_token_retention', 60 * 60 * 24 * 365);
$this->logger->debug('Invalidating auth tokens older than ' . date('c', $authTokenThreshold), ['app' => 'cron']);
$this->mapper->invalidateOld($authTokenThreshold, OCPIToken::PERMANENT_TOKEN);
}

It's probably such a subtle bit we could leave it out and assume there won't be any troubleshooting side effects for admins. I can't really think of any, unless - well, they clear their cookies then attempt to put them back in their browser or something and then wonder why they still work... ;-) Edit: And anyone that pokes around the database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants