smtp_configure.go: allow empty username/password

Closes https://gitlab.com/commento/commento/issues/126
This commit is contained in:
Adhityaa Chandrasekar 2019-05-01 18:34:37 -04:00
parent b67d2ba58c
commit 0b37b33530

View File

@ -13,12 +13,16 @@ func smtpConfigure() error {
password := os.Getenv("SMTP_PASSWORD")
host := os.Getenv("SMTP_HOST")
port := os.Getenv("SMTP_PORT")
if username == "" || password == "" || host == "" || port == "" {
if host == "" || port == "" {
logger.Warningf("smtp not configured, no emails will be sent")
smtpConfigured = false
return nil
}
if username == "" || password == "" {
logger.Warningf("no SMTP username/password set, Commento will assume they aren't required")
}
if os.Getenv("SMTP_FROM_ADDRESS") == "" {
logger.Errorf("COMMENTO_SMTP_FROM_ADDRESS not set")
smtpConfigured = false