mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +03:00
More explicit
This commit is contained in:
@@ -2670,6 +2670,7 @@ pub(crate) async fn get_chat_id_by_grpid(
|
|||||||
/// Adds a message to device chat.
|
/// Adds a message to device chat.
|
||||||
///
|
///
|
||||||
/// Optional `label` can be provided to ensure that message is added only once.
|
/// Optional `label` can be provided to ensure that message is added only once.
|
||||||
|
/// If `important` is true, a notification will be sent.
|
||||||
pub async fn add_device_msg_with_importance(
|
pub async fn add_device_msg_with_importance(
|
||||||
context: &Context,
|
context: &Context,
|
||||||
label: Option<&str>,
|
label: Option<&str>,
|
||||||
|
|||||||
@@ -119,7 +119,9 @@ pub enum Config {
|
|||||||
SysConfigKeys,
|
SysConfigKeys,
|
||||||
|
|
||||||
#[strum(props(default = "0"))]
|
#[strum(props(default = "0"))]
|
||||||
WarnedAboutWrongPw,
|
/// Whether we send a warning if the password is wrong (set to false when we send a warning
|
||||||
|
/// because we do not want to send a second warning)
|
||||||
|
NotifyAboutWrongPw,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Context {
|
impl Context {
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ impl Context {
|
|||||||
|
|
||||||
let mut param = LoginParam::from_database(self, "").await;
|
let mut param = LoginParam::from_database(self, "").await;
|
||||||
let success = configure(self, &mut param).await;
|
let success = configure(self, &mut param).await;
|
||||||
|
self.set_config(Config::NotifyAboutWrongPw, None).await?;
|
||||||
|
|
||||||
if let Some(provider) = provider::get_provider_info(¶m.addr) {
|
if let Some(provider) = provider::get_provider_info(¶m.addr) {
|
||||||
if let Some(config_defaults) = &provider.config_defaults {
|
if let Some(config_defaults) = &provider.config_defaults {
|
||||||
@@ -102,7 +103,8 @@ impl Context {
|
|||||||
|
|
||||||
match success {
|
match success {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
self.set_config(Config::WarnedAboutWrongPw, None).await?;
|
self.set_config(Config::NotifyAboutWrongPw, Some("1"))
|
||||||
|
.await?;
|
||||||
progress!(self, 1000);
|
progress!(self, 1000);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -313,12 +313,9 @@ impl Imap {
|
|||||||
|
|
||||||
let lock = context.wrong_pw_warning_mutex.lock().await;
|
let lock = context.wrong_pw_warning_mutex.lock().await;
|
||||||
if self.login_failed_once
|
if self.login_failed_once
|
||||||
&& !context.get_config_bool(Config::WarnedAboutWrongPw).await
|
&& context.get_config_bool(Config::NotifyAboutWrongPw).await
|
||||||
{
|
|
||||||
if let Err(e) = context
|
|
||||||
.set_config(Config::WarnedAboutWrongPw, Some("1"))
|
|
||||||
.await
|
|
||||||
{
|
{
|
||||||
|
if let Err(e) = context.set_config(Config::NotifyAboutWrongPw, None).await {
|
||||||
warn!(context, "{}", e);
|
warn!(context, "{}", e);
|
||||||
}
|
}
|
||||||
drop(lock);
|
drop(lock);
|
||||||
|
|||||||
Reference in New Issue
Block a user