jinnrry před 2 roky
rodič
revize
bd1c36339e
1 změnil soubory, kde provedl 12 přidání a 1 odebrání
  1. 12 1
      server/pop3_server/action.go

+ 12 - 1
server/pop3_server/action.go

@@ -13,6 +13,7 @@ import (
 	"pmail/utils/errors"
 	"pmail/utils/id"
 	"pmail/utils/password"
+	"strings"
 )
 
 type action struct {
@@ -25,6 +26,11 @@ func (a action) User(ctx *gopop.Data, username string) error {
 		ctx.Ctx = tc
 	}
 
+	infos := strings.Split(username, "@")
+	if len(infos) > 1 {
+		username = infos[0]
+	}
+
 	log.WithContext(ctx.Ctx).Debugf("POP3 User %s", username)
 
 	ctx.User = username
@@ -38,7 +44,7 @@ func (a action) Pass(ctx *gopop.Data, pwd string) error {
 		ctx.Ctx = tc
 	}
 
-	log.WithContext(ctx.Ctx).Debugf("POP3 PASS %s", pwd)
+	log.WithContext(ctx.Ctx).Debugf("POP3 PASS %s , User:%s", pwd, ctx.User)
 
 	var user models.User
 
@@ -69,6 +75,11 @@ func (a action) Apop(ctx *gopop.Data, username, digest string) error {
 		ctx.Ctx = tc
 	}
 
+	infos := strings.Split(username, "@")
+	if len(infos) > 1 {
+		username = infos[0]
+	}
+
 	log.WithContext(ctx.Ctx).Debugf("POP3 APOP %s %s", username, digest)
 
 	var user models.User