40 lines
745 B
Go
40 lines
745 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"git.tilde.town/tildetown/town/email"
|
|
)
|
|
|
|
const emailText = `hello!
|
|
|
|
You (hopefully) requested to add a new public key to your tilde.town account.
|
|
|
|
If you didn't, feel free to ignore this email (or report it to an admin).
|
|
|
|
If you did, here is your auth code: %s
|
|
|
|
To use this code, please open a terminal and run:
|
|
|
|
ssh help@tilde.town
|
|
|
|
Follow the instructions there to add your new key and restore access to your account.
|
|
|
|
best,
|
|
~vilmibm`
|
|
|
|
func sendAuthCodeEmail(ac AuthCode) error {
|
|
pw, err := email.LoadPassword()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
body := fmt.Sprintf(emailText, ac.Code)
|
|
|
|
mailer := email.NewExternalMailer(pw)
|
|
return mailer.Send(
|
|
ac.Email,
|
|
"Adding a new tilde.town public key",
|
|
body)
|
|
}
|