github.com/jordwest/imap-server@v0.0.0-20200627020849-1cf758ba359f/conn/command_login.go (about)

     1  package conn
     2  
     3  // Handles PLAIN text LOGIN command
     4  func cmdLogin(args commandArgs, c *Conn) {
     5  	user, err := c.Mailstore.Authenticate(args.Arg(0), args.Arg(1))
     6  	c.User = user
     7  	if err != nil {
     8  		c.writeResponse(args.ID(), "NO Incorrect username/password")
     9  		return
    10  	}
    11  	c.SetState(StateAuthenticated)
    12  	c.writeResponse(args.ID(), "OK Authenticated")
    13  }