Initial Commit
This commit is contained in:
18
templates/user/created.email.html
Normal file
18
templates/user/created.email.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>AVAM - Activate your Account</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>Thank you for joining Avii's Virtual Airline Manager.</p>
|
||||
|
||||
<p>Please click <a href="{{ activate_url }}" target="_BLANK">here</a> or go to <a href="{{ activate_url }}"
|
||||
target="_BLANK">{{ activate_url }}</a> to activate your
|
||||
account.</p>
|
||||
</body>
|
||||
|
||||
</html>
|
3
templates/user/created.email.txt
Normal file
3
templates/user/created.email.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
Thank you for joining Avii's Virtual Airline Manager.
|
||||
|
||||
Please go to {{ activate_url }} to activate your account.
|
17
templates/user/password_reset.email.html
Normal file
17
templates/user/password_reset.email.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>AVAM - Reset Password Request</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>Reset Password</p>
|
||||
|
||||
<p>Please click <a href="{{ reset_url }}" target="_BLANK">here</a> or go to <a href="{{ reset_url }}"
|
||||
target="_BLANK">{{ reset_url }}</a> to reset your password.</p>
|
||||
</body>
|
||||
|
||||
</html>
|
3
templates/user/password_reset.email.txt
Normal file
3
templates/user/password_reset.email.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
Password Reset
|
||||
|
||||
Please go to {{ reset_url }} to reset your password.
|
50
templates/user/user_notifier.rs
Normal file
50
templates/user/user_notifier.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use lettre::AsyncTransport;
|
||||
|
||||
use crate::domain::api::ports::UserNotifier;
|
||||
|
||||
use crate::domain::api::models::user::*;
|
||||
|
||||
use super::DangerousLettre;
|
||||
|
||||
impl UserNotifier for DangerousLettre {
|
||||
async fn user_created(&self, user: &User, token: &ActivationToken) {
|
||||
let mut context = tera::Context::new();
|
||||
|
||||
let url = format!("http://127.0.0.1:3000/auth/activate/{}", token); // Move base url to env
|
||||
|
||||
context.insert("activate_url", &url);
|
||||
|
||||
let to = format!("{}", user.email()).parse().unwrap();
|
||||
|
||||
let message = self
|
||||
.template("user/created", "Welcome to AVAM!", &context, to)
|
||||
.unwrap();
|
||||
|
||||
if let Err(e) = self.mailer.send(message).await {
|
||||
eprintln!("{:#?}", e);
|
||||
};
|
||||
}
|
||||
|
||||
async fn forgot_password(&self, user: &User, token: &ForgotPasswordToken) {
|
||||
let mut context = tera::Context::new();
|
||||
|
||||
let url = format!("http://127.0.0.1:3000/auth/reset/{}", token); // Move base url to env
|
||||
|
||||
context.insert("reset_url", &url);
|
||||
|
||||
let to = format!("{}", user.email()).parse().unwrap();
|
||||
|
||||
let message = self
|
||||
.template(
|
||||
"user/password_reset",
|
||||
"Password reset request",
|
||||
&context,
|
||||
to,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
if let Err(e) = self.mailer.send(message).await {
|
||||
eprintln!("{:#?}", e);
|
||||
};
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user