Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions crates/cli/src/dispatch_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,14 @@ fn run_invoice_command_with_base_path(
let data_path = data_path.as_ref();
let data = read_data_from_disk_with_base_path(data_path)?;
let input = input.parsed(*data.service_fees().cadence())?;
info!("🔮 Starting invoice PDF creation, input: {:?}...", input);
info!("🔮 Starting invoice PDF creation...");
let email_settings = input.email().clone();
let named_pdf = create_invoice_pdf_with_data(data, input, render_invoice)?;
save_pdf_location_to_tmp_file(named_pdf.saved_at().clone())?;
if let Some(email_settings) = email_settings {
send_email_with_settings_for_pdf(&named_pdf, &email_settings)?
info!("Sending email with invoice...");
send_email_with_settings_for_pdf(&named_pdf, &email_settings)?;
info!("✅ Sent email with invoice");
}
Ok(named_pdf)
}
Expand Down
5 changes: 5 additions & 0 deletions crates/cli/src/input/tui/helpers/build_password.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use log::info;
use rpassword::prompt_password;
use secrecy::{ExposeSecret as _, SecretString};

Expand Down Expand Up @@ -66,6 +67,10 @@ pub fn ask_for_email_encryption_password_with_confirmation(
) -> Result<SecretString> {
if let Ok(env_pw) = std::env::var(ENV_VAR_KLIRR_EMAIL_ENCRYPTION_PASSWORD) {
if env_pw.len() >= PASSWORD_MIN_LENGTH {
info!(
"Read encryption password from ENV variable (`{}`) so skipping prompting of it",
ENV_VAR_KLIRR_EMAIL_ENCRYPTION_PASSWORD
);
return Ok(SecretString::from(env_pw));
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/core-invoice/src/logic/send_email.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn send_email_with_credentials(email: Email, credentials: EmailCredentials) -> R
let smtp_server = credentials.smtp_server().clone();
let creds = Credentials::from(credentials);

// Open a remote connection to gmail
// Open a remote connection to SMTP server
let mailer = SmtpTransport::relay(smtp_server.as_ref())
.map_err(crate::Error::create_smtp_transport_error)?
.credentials(creds)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl TryFrom<EmailWithSender> for Message {
impl From<EmailCredentials> for Credentials {
fn from(credentials: EmailCredentials) -> Self {
Credentials::new(
credentials.account().email().user().to_owned(),
credentials.account().email().to_string(),
credentials.password().expose_secret().to_owned(),
)
}
Expand Down Expand Up @@ -147,7 +147,7 @@ mod tests {

assert_eq!(
mechanism.response(&credentials, Some("Username")).unwrap(),
"alice"
"alice@example.com"
);
assert_eq!(
mechanism.response(&credentials, Some("Password")).unwrap(),
Expand Down
5 changes: 2 additions & 3 deletions crates/core-invoice/src/models/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,8 @@ impl Error {
}
}

/// Logs a decryption error and maps it to [`Error::AESDecryptionFailed`].
pub fn aes_decryption_failed(error: impl std::fmt::Debug) -> Self {
log::error!("Failed to AES decrypt data - error: {error:?}");
/// Maps a decryption failure to [`Error::AESDecryptionFailed`].
pub fn aes_decryption_failed(_error: impl std::fmt::Debug) -> Self {
Self::AESDecryptionFailed
}
}
Expand Down
Loading