mirror of
https://github.com/chatmail/core.git
synced 2026-05-13 11:56:30 +03:00
fix: is_configured(): Ensure that public key exists when returning true
We don't want configured accounts w/o a public key. The self-color depends on it.
This commit is contained in:
@@ -27,6 +27,7 @@ use crate::config::{self, Config};
|
|||||||
use crate::constants::NON_ALPHANUMERIC_WITHOUT_DOT;
|
use crate::constants::NON_ALPHANUMERIC_WITHOUT_DOT;
|
||||||
use crate::context::Context;
|
use crate::context::Context;
|
||||||
use crate::imap::Imap;
|
use crate::imap::Imap;
|
||||||
|
use crate::key;
|
||||||
use crate::log::{LogExt, info, warn};
|
use crate::log::{LogExt, info, warn};
|
||||||
pub use crate::login_param::EnteredLoginParam;
|
pub use crate::login_param::EnteredLoginParam;
|
||||||
use crate::login_param::{
|
use crate::login_param::{
|
||||||
@@ -62,7 +63,16 @@ macro_rules! progress {
|
|||||||
impl Context {
|
impl Context {
|
||||||
/// Checks if the context is already configured.
|
/// Checks if the context is already configured.
|
||||||
pub async fn is_configured(&self) -> Result<bool> {
|
pub async fn is_configured(&self) -> Result<bool> {
|
||||||
self.sql.exists("SELECT COUNT(*) FROM transports", ()).await
|
if !self
|
||||||
|
.sql
|
||||||
|
.exists("SELECT COUNT(*) FROM transports", ())
|
||||||
|
.await?
|
||||||
|
{
|
||||||
|
return Ok(false);
|
||||||
|
}
|
||||||
|
// We don't want configured accounts w/o a public key. The self-color depends on it.
|
||||||
|
key::load_self_public_key(self).await?;
|
||||||
|
Ok(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Configures this account with the currently provided parameters.
|
/// Configures this account with the currently provided parameters.
|
||||||
|
|||||||
Reference in New Issue
Block a user