initial, rought, not-user-friendly support for multi-domain setup

This commit is contained in:
Aine
2022-11-08 18:16:38 +02:00
parent 8954a7801a
commit 15d5afe90f
14 changed files with 70 additions and 45 deletions

View File

@@ -73,7 +73,14 @@ func (b *Bot) allowSend(actorID id.UserID, targetRoomID id.RoomID) bool {
// AllowAuth check if SMTP login (email) and password are valid
func (b *Bot) AllowAuth(email, password string) bool {
if !strings.HasSuffix(email, "@"+b.domain) {
var suffix bool
for _, domain := range b.domains {
if strings.HasSuffix(email, "@"+domain) {
suffix = true
break
}
}
if !suffix {
return false
}