Generate reset password URL

This commit is contained in:
2023-05-30 15:12:58 +02:00
parent c84c2ef3c5
commit 62a52b385e
10 changed files with 418 additions and 16 deletions

@ -55,6 +55,38 @@ pub struct AppConfig {
/// Redis password
#[clap(long, env, default_value = "secretredis")]
redis_password: String,
/// Mail sender
#[clap(long, env, default_value = "geneit@example.com")]
pub mail_sender: String,
/// SMTP relay
#[clap(long, env, default_value = "localhost")]
pub smtp_relay: String,
/// SMTP port
#[clap(long, env, default_value_t = 1025)]
pub smtp_port: u16,
/// SMTP use TLS to connect to relay
#[clap(long, env)]
pub smtp_tls: bool,
/// SMTP username
#[clap(long, env)]
pub smtp_username: Option<String>,
/// SMTP password
#[clap(long, env)]
pub smtp_password: Option<String>,
/// Password reset URL
#[clap(
long,
env,
default_value = "http://localhost:3000/reset_password#TOKEN"
)]
pub reset_password_url: String,
}
lazy_static::lazy_static! {
@ -88,4 +120,9 @@ impl AppConfig {
},
}
}
/// Get password reset URL
pub fn get_password_reset_url(&self, token: &str) -> String {
self.reset_password_url.replace("TOKEN", token)
}
}