From 9129f8e38c84a1bf91c73760d1dbb2510290ee3d Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Fri, 23 Sep 2022 07:35:35 +0000 Subject: [PATCH] Apply 1 suggestion(s) to 1 file(s) --- bot/access.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bot/access.go b/bot/access.go index 74fc61e..31064c2 100644 --- a/bot/access.go +++ b/bot/access.go @@ -68,9 +68,13 @@ func (b *Bot) allowSend(actorID id.UserID, targetRoomID id.RoomID) bool { return !cfg.NoSend() } -// AllowAuth check if SMTP login (mailbox) and password are valid -func (b *Bot) AllowAuth(mailbox, password string) bool { - roomID, ok := b.GetMapping(mailbox) +// AllowAuth check if SMTP login (email) and password are valid +func (b *Bot) AllowAuth(email, password string) bool { + if !strings.HasSuffix(email, "@"+b.domain) { + return false + } + + roomID, ok := b.GetMapping(utils.Mailbox(email)) if !ok { return false }