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

"Remember me" fails after closing browser #719

Closed
Pofilo opened this issue Nov 29, 2022 · 8 comments
Closed

"Remember me" fails after closing browser #719

Pofilo opened this issue Nov 29, 2022 · 8 comments
Labels
bug Something isn't working

Comments

@Pofilo
Copy link

Pofilo commented Nov 29, 2022

Describe the bug
Open session, close then reopen browser then I expect to remain connected.

To Reproduce
Steps to reproduce the behavior:

  1. Connect with "Remember me" activated.
  2. Close browser then reopen it.
  3. Need to reconnect again.
  4. Can see in the console that the "smremember" cookie has been rejected because it has expired.

However, if I check the cookie before closing my browser, it will expire in a month.

Please complete the following information:

  • Browser: [e.g. edge 107.0.1418.62, firefox 107.0]
  • PHP version: 8.1.12
  • SnappyMail Version: 2.22.4 (migrate from 2.20.0 yesterday)

Debug/logging information
If needed, I can provide more logs.

@the-djmaze
Copy link
Owner

This might be related to #713 where encryption key has moved to localStorage and cookie.
Can you check if the smctoken changes?

@Pofilo
Copy link
Author

Pofilo commented Nov 29, 2022

smctoken remains the same after reopening the browser and logging in again.

@the-djmaze
Copy link
Owner

Can you delete all cookies and try again?

Somehow i can't reproduce the issue.

@Pofilo
Copy link
Author

Pofilo commented Nov 29, 2022

Same with cookies cleaned (and with fresh web browser).

Logs when going to the page (when I'm supposed to remain connected (debug=7)):

[2022-11-29 16:11:23.449][678964ee] [INFO]: [SM:2.22.4][IP:xx.xx.xx.xx][PID:85][nginx/1.18.0][fpm-fcgi][Streams:tcp,udp,unix,udg,ssl,tls,tlsv1.0,tlsv1.1,tlsv1.2,tlsv1.3][GET https://mail.example.com/]
[2022-11-29 16:11:23.449][678964ee] smremember[NOTICE]: invalid
[2022-11-29 16:11:23.450][678964ee] smremember[NOTICE]: invalid
[2022-11-29 16:11:23.457][678964ee] [INFO]: Memory peak usage: 2MB
[2022-11-29 16:11:23.457][678964ee] [INFO]: Time delta: 0.0098228454589844
[2022-11-29 16:11:23.809][4c33b3d3] [INFO]: [SM:2.22.4][IP:192.168.56.104][PID:85][nginx/1.18.0][fpm-fcgi][Streams:tcp,udp,unix,udg,ssl,tls,tlsv1.0,tlsv1.1,tlsv1.2,tlsv1.3][GET https://mail.example.com/?/AppData/0/xxxxxxxxxxxxxxxxx/]
[2022-11-29 16:11:23.810][4c33b3d3] APPDATA[INFO]: rl.initData({"Auth":false,"Title":"Snappymail","LoadingDescription":"Snappymail","Plugins":[],"System":{"version":"2.22.4","token":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","languages":["ar-SA","bg-BG","cs-CZ","da-DK","de-DE","el-GR","en","en-GB","es-ES","et-EE","eu","fa-IR","fi-FI","fr-FR","hu-HU","id-ID","is-IS","it-IT","ja-JP","ko-KR","lt-LT","lv-LV","nb-NO","nl-NL","pl-PL","pt","pt-BR","pt-PT","ro-RO","ru-RU","sk-SK","sl-SI","sv-SE","tr-TR","uk-UA","vi-VN","zh-CN","zh-TW"],"webPath":"\/","webVersionPath":"\/snappymail\/v\/2.22.4\/"},"AllowLanguagesOnLogin":true,"DevEmail":"","DevPassword":"","SignMe":"DefaultOff","AdditionalLoginError":"","Theme":"Default","Language":"fr-FR","UserLanguage":"fr-FR","PluginsLink":"","StaticLibsJs":"\/snappymail\/v\/2.22.4\/static\/js\/min\/libs.min.js"});
[2022-11-29 16:11:23.811][4c33b3d3] [INFO]: Memory peak usage: 2MB
[2022-11-29 16:11:23.811][4c33b3d3] [INFO]: Time delta: 0.0030219554901123

@the-djmaze
Copy link
Owner

I've modified the core code a bit to log more Crypt actions, so we hopefully can find out the problem.

As this was also an issue in #636, #537 and #443

@the-djmaze the-djmaze changed the title Not connected anymore when closing browser "Remember me" fails after closing browser Nov 30, 2022
@Pofilo
Copy link
Author

Pofilo commented Nov 30, 2022

It's working again on master.
However, I'm getting those logs:

[2022-11-30 18:59:17.035][fb307bdd] [INFO]: [SM:2.22.4][IP:192.168.56.104][PID:83][nginx/1.18.0][fpm-fcgi][Streams:tcp,udp,unix,udg,ssl,tls,tlsv1.0,tlsv1.1,tlsv1.2,tlsv1.3][GET https://mail.example.com/]
[2022-11-30 18:59:17.035][fb307bdd] Crypt[WARNING]: Decrypt() invalid $data or $key
[2022-11-30 18:59:17.035][fb307bdd] smremember[NOTICE]: invalid
[2022-11-30 18:59:17.037][fb307bdd] [INFO]: Memory peak usage: 2MB
[2022-11-30 18:59:17.037][fb307bdd] [INFO]: Time delta: 0.0040390491485596
[2022-11-30 18:59:17.224][82d85177] [INFO]: [SM:2.22.4][IP:192.168.56.104][PID:83][nginx/1.18.0][fpm-fcgi][Streams:tcp,udp,unix,udg,ssl,tls,tlsv1.0,tlsv1.1,tlsv1.2,tlsv1.3][GET https://mail.example.com/?/AppData/0/xxxxxxxxxxxxxxxxx/]
[2022-11-30 18:59:17.226][82d85177] IMAP[INFO]: Start connection to "ssl://xxx.example.net:993"
[2022-11-30 18:59:17.330][82d85177] IMAP[INFO]: Connect (success)

@the-djmaze
Copy link
Owner

I'm on to something, still figuring out.

the-djmaze pushed a commit that referenced this issue Dec 1, 2022
the-djmaze pushed a commit that referenced this issue Dec 2, 2022
Don't clear SignMe cookie due conflict with new smctoken cookie.
@the-djmaze the-djmaze added the bug Something isn't working label Dec 2, 2022
@the-djmaze
Copy link
Owner

Resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants