diff --git a/src/api/admin.rs b/src/api/admin.rs index 3fe4f947..5176ee3c 100644 --- a/src/api/admin.rs +++ b/src/api/admin.rs @@ -18,7 +18,9 @@ use crate::{ db::{backup_database, get_sql_server_version, models::*, DbConn, DbConnType}, error::{Error, MapResult}, mail, - util::{format_naive_datetime_local, get_display_size, get_reqwest_client, is_running_in_docker}, + util::{ + docker_base_image, format_naive_datetime_local, get_display_size, get_reqwest_client, is_running_in_docker, + }, CONFIG, }; @@ -492,6 +494,7 @@ fn diagnostics(_token: AdminToken, ip_header: IpHeader, conn: DbConn) -> ApiResu // Execute some environment checks let running_within_docker = is_running_in_docker(); + let docker_base_image = docker_base_image(); let has_http_access = has_http_access(); let uses_proxy = env::var_os("HTTP_PROXY").is_some() || env::var_os("http_proxy").is_some() @@ -549,6 +552,7 @@ fn diagnostics(_token: AdminToken, ip_header: IpHeader, conn: DbConn) -> ApiResu "web_vault_version": web_vault_version.version, "latest_web_build": latest_web_build, "running_within_docker": running_within_docker, + "docker_base_image": docker_base_image, "has_http_access": has_http_access, "ip_header_exists": &ip_header.0.is_some(), "ip_header_match": ip_header_name == CONFIG.ip_header(), diff --git a/src/mail.rs b/src/mail.rs index f4278bef..55d944d4 100644 --- a/src/mail.rs +++ b/src/mail.rs @@ -473,15 +473,28 @@ fn send_email(address: &str, subject: &str, body_html: String, body_text: String // Match some common errors and make them more user friendly Err(e) => { if e.is_client() { - err!(format!("SMTP Client error: {}", e)); + debug!("SMTP Client error: {:#?}", e); + err!(format!("SMTP Client error: {}", e.to_string())); } else if e.is_transient() { - err!(format!("SMTP 4xx error: {:?}", e)); + debug!("SMTP 4xx error: {:#?}", e); + err!(format!("SMTP 4xx error: {}", e.to_string())); } else if e.is_permanent() { - err!(format!("SMTP 5xx error: {:?}", e)); + debug!("SMTP 5xx error: {:#?}", e); + let mut msg = e.to_string(); + // Add a special check for 535 to add a more descriptive message + if msg.contains("(535)") { + msg = format!("{} - Authentication credentials invalid", msg); + } + err!(format!("SMTP 5xx error: {}", msg)); } else if e.is_timeout() { - err!(format!("SMTP timeout error: {:?}", e)); + debug!("SMTP timeout error: {:#?}", e); + err!(format!("SMTP timeout error: {}", e.to_string())); + } else if e.is_tls() { + debug!("SMTP Encryption error: {:#?}", e); + err!(format!("SMTP Encryption error: {}", e.to_string())); } else { - Err(e.into()) + debug!("SMTP {:#?}", e); + err!(format!("SMTP {}", e.to_string())); } } } diff --git a/src/static/templates/admin/base.hbs b/src/static/templates/admin/base.hbs index 94684ede..9c876723 100644 --- a/src/static/templates/admin/base.hbs +++ b/src/static/templates/admin/base.hbs @@ -62,8 +62,8 @@ headers: { "Content-Type": "application/json" } }).then( resp => { if (resp.ok) { msg(successMsg, reload_page); return Promise.reject({error: false}); } - respStatus = resp.status; - respStatusText = resp.statusText; + const respStatus = resp.status; + const respStatusText = resp.statusText; return resp.text(); }).then( respText => { try { @@ -126,9 +126,9 @@ // get current URL path and assign 'active' class to the correct nav-item (() => { - var pathname = window.location.pathname; + const pathname = window.location.pathname; if (pathname === "") return; - var navItem = document.querySelectorAll('.navbar-nav .nav-item a[href="'+pathname+'"]'); + let navItem = document.querySelectorAll('.navbar-nav .nav-item a[href="'+pathname+'"]'); if (navItem.length === 1) { navItem[0].className = navItem[0].className + ' active'; navItem[0].setAttribute('aria-current', 'page'); diff --git a/src/static/templates/admin/diagnostics.hbs b/src/static/templates/admin/diagnostics.hbs index 4c4575ad..315acc97 100644 --- a/src/static/templates/admin/diagnostics.hbs +++ b/src/static/templates/admin/diagnostics.hbs @@ -58,7 +58,7 @@