mirror of
https://github.com/1f349/lotus.git
synced 2024-12-23 08:34:06 +00:00
21 lines
423 B
Go
21 lines
423 B
Go
|
package fake
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"github.com/emersion/go-imap"
|
||
|
"github.com/emersion/go-imap/backend"
|
||
|
)
|
||
|
|
||
|
type Backend struct {
|
||
|
Debug chan []byte
|
||
|
Username string
|
||
|
Password string
|
||
|
}
|
||
|
|
||
|
func (i *Backend) Login(connInfo *imap.ConnInfo, username, password string) (backend.User, error) {
|
||
|
if username != i.Username || password != i.Password {
|
||
|
return nil, fmt.Errorf("invalid user")
|
||
|
}
|
||
|
return &User{i.Debug, username}, nil
|
||
|
}
|