From c2f35df455910ad1fd38568efa8839e020afa28b Mon Sep 17 00:00:00 2001 From: Conrad Hoffmann Date: Tue, 3 May 2022 16:59:39 +0200 Subject: [PATCH] Add some debug output to auth module --- auth/imap.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/auth/imap.go b/auth/imap.go index 0b8c4d3..268cedf 100644 --- a/auth/imap.go +++ b/auth/imap.go @@ -6,6 +6,8 @@ import ( "github.com/emersion/go-imap/client" "github.com/emersion/go-sasl" + + "git.sr.ht/~sircmpwn/tokidoki/debug" ) type IMAPProvider struct { @@ -43,6 +45,7 @@ func (prov *IMAPProvider) doAuth(next http.Handler, conn, err := prov.dial() if err != nil { + debug.Printf("Auth dial error: %v", err) http.Error(w, "Temporary authentication error, try again later", http.StatusServiceUnavailable) return } @@ -50,6 +53,7 @@ func (prov *IMAPProvider) doAuth(next http.Handler, auth := sasl.NewPlainClient("", user, pass) if err := conn.Authenticate(auth); err != nil { + debug.Printf("Auth error: %v", err) http.Error(w, "Invalid username or password", http.StatusUnauthorized) return }