mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 12:56:30 +03:00
configure: always try at least one IMAP and SMTP server
Previously empty autoconfig resulted in no servers being tried and no error displayed.
This commit is contained in:
committed by
link2xt
parent
5a9a4dbbab
commit
8156692e5a
@@ -217,28 +217,32 @@ async fn configure(ctx: &Context, param: &mut LoginParam) -> Result<()> {
|
|||||||
|
|
||||||
progress!(ctx, 500);
|
progress!(ctx, 500);
|
||||||
|
|
||||||
let servers = expand_param_vector(
|
let mut servers = param_autoconfig.unwrap_or_default();
|
||||||
param_autoconfig.unwrap_or_else(|| {
|
if !servers
|
||||||
vec![
|
.iter()
|
||||||
ServerParams {
|
.any(|server| server.protocol == Protocol::IMAP)
|
||||||
|
{
|
||||||
|
servers.push(ServerParams {
|
||||||
protocol: Protocol::IMAP,
|
protocol: Protocol::IMAP,
|
||||||
hostname: param.imap.server.clone(),
|
hostname: param.imap.server.clone(),
|
||||||
port: param.imap.port,
|
port: param.imap.port,
|
||||||
socket: param.imap.security,
|
socket: param.imap.security,
|
||||||
username: param.imap.user.clone(),
|
username: param.imap.user.clone(),
|
||||||
},
|
})
|
||||||
ServerParams {
|
}
|
||||||
|
if !servers
|
||||||
|
.iter()
|
||||||
|
.any(|server| server.protocol == Protocol::SMTP)
|
||||||
|
{
|
||||||
|
servers.push(ServerParams {
|
||||||
protocol: Protocol::SMTP,
|
protocol: Protocol::SMTP,
|
||||||
hostname: param.smtp.server.clone(),
|
hostname: param.smtp.server.clone(),
|
||||||
port: param.smtp.port,
|
port: param.smtp.port,
|
||||||
socket: param.smtp.security,
|
socket: param.smtp.security,
|
||||||
username: param.smtp.user.clone(),
|
username: param.smtp.user.clone(),
|
||||||
},
|
})
|
||||||
]
|
}
|
||||||
}),
|
let servers = expand_param_vector(servers, ¶m.addr, ¶m_domain);
|
||||||
¶m.addr,
|
|
||||||
¶m_domain,
|
|
||||||
);
|
|
||||||
|
|
||||||
progress!(ctx, 550);
|
progress!(ctx, 550);
|
||||||
|
|
||||||
@@ -560,7 +564,9 @@ async fn nicer_configuration_error(context: &Context, errors: Vec<ConfigurationE
|
|||||||
let first_err = if let Some(f) = errors.first() {
|
let first_err = if let Some(f) = errors.first() {
|
||||||
f
|
f
|
||||||
} else {
|
} else {
|
||||||
return "".to_string();
|
// This means configuration failed but no errors have been captured. This should never
|
||||||
|
// happen, but if it does, the user will see classic "Error: no error".
|
||||||
|
return "no error".to_string();
|
||||||
};
|
};
|
||||||
|
|
||||||
if errors
|
if errors
|
||||||
|
|||||||
Reference in New Issue
Block a user