email sending & magic links (that work)
This commit is contained in:
parent
5204994769
commit
cd07ff5310
|
@ -22,15 +22,15 @@ url = "postgres://postgres:postgres@localhost/trifid2"
|
|||
# (Required) The mail server to connect to
|
||||
server = "mail.e3t.cc"
|
||||
# (Required) The SMTP port to connect to.
|
||||
port = 587
|
||||
port = 465
|
||||
# (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.
|
||||
password = "$PASSWORD$"
|
||||
# (Required) The "From Name" to send the email from
|
||||
from_name = "Trifid"
|
||||
# (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.
|
||||
template = "Click this link to sign in! http://localhost:5173/magic-link?magicLinkToken=%TOKEN%"
|
||||
# (Required) Should STARTTLS be used?
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
CREATE TABLE magic_links (
|
||||
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
|
||||
);
|
|
@ -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));
|
||||
|
||||
let mut password = config.email.password.clone();
|
||||
if password == "%PASSWORD%" {
|
||||
if password == "$PASSWORD$" {
|
||||
password = std::env::var("TRIFID_EMAIL_PASSWORD")?.clone();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue