email sending & magic links (that work)
/ build_x64 (push) Successful in 2m9s Details
/ build_arm64 (push) Successful in 2m37s Details
/ build_win64 (push) Successful in 2m38s Details
/ build (push) Successful in 50s Details

This commit is contained in:
core 2023-11-19 11:36:06 -05:00
parent 5204994769
commit cd07ff5310
Signed by: core
GPG Key ID: FDBF740DADDCEECF
3 changed files with 5 additions and 5 deletions

View File

@ -22,15 +22,15 @@ url = "postgres://postgres:postgres@localhost/trifid2"
# (Required) The mail server to connect to # (Required) The mail server to connect to
server = "mail.e3t.cc" server = "mail.e3t.cc"
# (Required) The SMTP port to connect to. # (Required) The SMTP port to connect to.
port = 587 port = 465
# (Required) The username to authenticate with. # (Required) The username to authenticate with.
username = "username" username = "core"
# (Required) The password to authenticate with. If set to %PASSWORD%, will be filled from the environment variable TRIFID_EMAIL_PASSWORD. # (Required) The password to authenticate with. If set to %PASSWORD%, will be filled from the environment variable TRIFID_EMAIL_PASSWORD.
password = "$PASSWORD$" password = "$PASSWORD$"
# (Required) The "From Name" to send the email from # (Required) The "From Name" to send the email from
from_name = "Trifid" from_name = "Trifid"
# (Required) The address to send the email from # (Required) The address to send the email from
from_email = "trifid@e3t.cc" from_email = "core@e3t.cc"
# (Required) The email template to use. %TOKEN% will be replaced with the magic link token. # (Required) The email template to use. %TOKEN% will be replaced with the magic link token.
template = "Click this link to sign in! http://localhost:5173/magic-link?magicLinkToken=%TOKEN%" template = "Click this link to sign in! http://localhost:5173/magic-link?magicLinkToken=%TOKEN%"
# (Required) Should STARTTLS be used? # (Required) Should STARTTLS be used?

View File

@ -1,5 +1,5 @@
CREATE TABLE magic_links ( CREATE TABLE magic_links (
id VARCHAR NOT NULL PRIMARY KEY, id VARCHAR NOT NULL PRIMARY KEY,
user_id VARCHAR NOT NULL REFERENCES users(id), user_id VARCHAR NOT NULL REFERENCES users(id) ON DELETE CASCADE,
expires TIMESTAMP NOT NULL expires TIMESTAMP NOT NULL
); );

View File

@ -11,7 +11,7 @@ pub async fn send_email(token: &str, to_address: &str, config: &Config) -> Resul
.text_body(config.email.template.replace("%TOKEN%", token)); .text_body(config.email.template.replace("%TOKEN%", token));
let mut password = config.email.password.clone(); let mut password = config.email.password.clone();
if password == "%PASSWORD%" { if password == "$PASSWORD$" {
password = std::env::var("TRIFID_EMAIL_PASSWORD")?.clone(); password = std::env::var("TRIFID_EMAIL_PASSWORD")?.clone();
} }