Send email with change game password link
Dependencies
- [2]
NLEIFOAGAdd dependency to send mails - [3]
I6SOPEQFCreate and store reset password token - [4]
BCXEUKX6Add config, static files and web server - [5]
ZE5UFPX4Add TTL cache for CSRF - [6]
CMA5SKJ3Copy turns Atom generator - [7]
WVHXYKCVAdd postgresql pools - [8]
Z3SYSC25Add SMTP configuration - [9]
3HT5CE6SManage TTL duration in config - [*]
HZDCKIXQUse constants for templates - [*]
WLWTNO4YCreate form to request game password change link - [*]
EVP2FSBHSplit index page - [*]
4MZ4VIR7Initial commit - [*]
IM5ZPD4NUpdate dependencies
Change contents
- edit in src/pages/query_reset_game_pwd.rs at line 48
async fn send_email(mailer: &lettre::AsyncSmtpTransport<lettre::Tokio1Executor>,mailer_from: &lettre::message::Mailbox,token_url: String,to: &str,) -> Result<(), Box<dyn std::error::Error>> {let email = lettre::Message::builder().from(mailer_from.clone()).to(to.parse()?).subject("FreeOrion reset game password link").body(format!("You requested change for FreeOrion game password.\n\Use next link {} to enter new password. Link is active for 24 hours.\n\Don't send it to other people.",token_url))?;use lettre::AsyncTransport;mailer.send(email).await?;Ok(())} - edit in src/pages/query_reset_game_pwd.rs at line 159
if let Err(e) = send_email(&data.mailer, &data.mailer_from, token_url, &form.contact).await {log::error!("Cann't send email: {}", e);return HttpResponse::ServiceUnavailable().body(actix_web::body::None::new());} - edit in src/pages/mod.rs at line 33
pub mailer: lettre::AsyncSmtpTransport<lettre::Tokio1Executor>,pub mailer_from: lettre::message::Mailbox, - edit in src/main.rs at line 49
mail, - edit in src/main.rs at line 52
.. - edit in src/main.rs at line 110
let smtp_credentials =lettre::transport::smtp::authentication::Credentials::new(mail.login, mail.passwd); - edit in src/main.rs at line 124
mailer: lettre::AsyncSmtpTransport::<lettre::Tokio1Executor>::relay(&mail.server).expect("Mail relay server").credentials(smtp_credentials).build(),mailer_from: lettre::message::Mailbox::new(None,mail.from.parse::<lettre::address::Address>().expect("Mail from address"),), - replacement in Cargo.toml at line 38
features = ["hostname", "tokio1-rustls-tls", "smtp-transport"]features = ["hostname", "tokio1", "tokio1-rustls-tls", "smtp-transport", "builder"] - edit in Cargo.lock at line 534
name = "email-encoding"version = "0.1.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "6690291166824e467790ac08ba42f241791567e8337bbf00c5a6e87889629f98"dependencies = ["base64",][[package]] - edit in Cargo.lock at line 577[4.4002][15.5313]
name = "fastrand"version = "1.7.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf"dependencies = ["instant",][[package]] - edit in Cargo.lock at line 938
"email-encoding","fastrand", - edit in Cargo.lock at line 943
"httpdate", - edit in Cargo.lock at line 945
"mime", - edit in Cargo.lock at line 948
"quoted_printable", - edit in Cargo.lock at line 1372
name = "quoted_printable"version = "0.4.5"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "3fee2dce59f7a43418e3382c766554c614e06a552d53a8f07ef499ea4b332c0f"[[package]]