deltachat-core-rust icon indicating copy to clipboard operation
deltachat-core-rust copied to clipboard

fix: Set Config::NotifyAboutWrongPw before saving configuration (#5896)

Open iequidoo opened this issue 1 year ago • 4 comments

Fix #5896

iequidoo avatar Sep 14 '24 01:09 iequidoo

Have you checked that during failed configuration device message is not added? During configuration Imap::connect is called here: https://github.com/deltachat/deltachat-core-rust/blob/f7a705c6da9e6805f12156581aa867740b382756/src/configure.rs#L423

It adds device message if it fails second time. I guess login_failed_once is set to false and device message will not be added.

link2xt avatar Sep 16 '24 21:09 link2xt

Maybe Config::NotifyAboutWrongPw can be removed completely? In-memory login_failed_once is enough to prevent adding device message if we only try to connect once. If we fail multiple times with a single Imap instance, add device message with some special label to prevent spamming device chat. If we succeed, remove the message with this label.

link2xt avatar Sep 16 '24 23:09 link2xt

Have you checked that during failed configuration device message is not added? During configuration Imap::connect is called here:

https://github.com/deltachat/deltachat-core-rust/blob/f7a705c6da9e6805f12156581aa867740b382756/src/configure.rs#L423

It adds device message if it fails second time. I guess login_failed_once is set to false and device message will not be added.

During initial configuration it's not added, but if the user runs reconfiguration, it's added unfortunately. Because it's not safe to disable NotifyAboutWrongPw during reconfiguration, otherwise if the program crashes, the setting will remain disabled. This can be fixed if we pass more context to configure().

iequidoo avatar Sep 17 '24 00:09 iequidoo

I tried to simplify the logic and now (re)configuration doesn't add device messages about wrong password

iequidoo avatar Sep 17 '24 03:09 iequidoo