fix: feedback on teh email users get sent when verifying their discord accounts
All checks were successful
On_Push / lint_clippy (push) Successful in 28s
On_Push / lint_fmt (push) Successful in 40s
On_Push / build (push) Successful in 3m39s
On_Push / deploy (push) Successful in 13s

This commit is contained in:
silver 2025-02-26 17:02:47 +00:00
parent 44bb40d96d
commit f046410cdc
Signed by: silver
GPG key ID: 36F93D61BAD3FD7D

View file

@ -87,7 +87,7 @@ pub mod link {
// generate a auth key // generate a auth key
let auth = random_string(20); let auth = random_string(20);
match send_mail(&config, &details, &auth, &command.user.name) { match send_mail(&config, &details.email, &auth, &command.user.name) {
Ok(_) => match save_to_db(&db, &details, &auth, &command.user.id).await { Ok(_) => match save_to_db(&db, &details, &auth, &command.user.id).await {
Ok(_) => {} Ok(_) => {}
Err(e) => { Err(e) => {
@ -136,23 +136,22 @@ pub mod link {
.ok() .ok()
} }
fn send_mail(config: &Config, email: &Wolves, auth: &str, user: &str) -> Result<smtp::response::Response, smtp::Error> { fn send_mail(config: &Config, mail: &str, auth: &str, user: &str) -> Result<smtp::response::Response, smtp::Error> {
let mail = &email.email;
let discord = "https://computer.discord.skynet.ie"; let discord = "https://computer.discord.skynet.ie";
let sender = format!("UL Computer Society <{}>", &config.mail_user); let sender = format!("UL Computer Society <{}>", &config.mail_user);
// Create the html we want to send. // Create the html we want to send.
let html = html! { let html = html! {
head { head {
title { "Hello from Skynet!" } title { "UL Wolves Discord Linker" }
style type="text/css" { style type="text/css" {
"h2, h4 { font-family: Arial, Helvetica, sans-serif; }" "h2, h4 { font-family: Arial, Helvetica, sans-serif; }"
} }
} }
div { div {
h2 { "Hello from Skynet!" } h2 { "UL Wolves Discord Linker" }
h3 { "Link your Account" } h3 { "Link your UL Wolves Account to Discord" }
// Substitute in the name of our recipient. // Substitute in the name of our recipient.
p { "Hi " (user) "," } p { "Hi " (user) "," }
p { p {
@ -166,9 +165,6 @@ pub mod link {
"If you have issues please refer to our Computer Society Discord Server:" "If you have issues please refer to our Computer Society Discord Server:"
br; br;
a href=(discord) { (discord) } a href=(discord) { (discord) }
}
p {
"Skynet Team"
br; br;
"UL Computer Society" "UL Computer Society"
} }
@ -177,7 +173,8 @@ pub mod link {
let body_text = format!( let body_text = format!(
r#" r#"
Hello from Skynet! UL Wolves Discord Linker
Link your UL Wolves Account to Discord
Link your Account Link your Account
@ -192,9 +189,7 @@ pub mod link {
If you have issues please refer to our Computer Society Discord Server: If you have issues please refer to our Computer Society Discord Server:
{discord} {discord}
UL Computer Society
Skynet Team
UL Computer Society
"# "#
); );
@ -202,7 +197,7 @@ pub mod link {
let email = Message::builder() let email = Message::builder()
.from(sender.parse().unwrap()) .from(sender.parse().unwrap())
.to(mail.parse().unwrap()) .to(mail.parse().unwrap())
.subject("Skynet-Discord: Link Wolves.") .subject("Skynet: Link Discord to Wolves.")
.multipart( .multipart(
// This is composed of two parts. // This is composed of two parts.
// also helps not trip spam settings (uneven number of url's // also helps not trip spam settings (uneven number of url's