Add some debug output to auth module
This commit is contained in:
parent
001917295d
commit
c2f35df455
@ -6,6 +6,8 @@ import (
|
|||||||
|
|
||||||
"github.com/emersion/go-imap/client"
|
"github.com/emersion/go-imap/client"
|
||||||
"github.com/emersion/go-sasl"
|
"github.com/emersion/go-sasl"
|
||||||
|
|
||||||
|
"git.sr.ht/~sircmpwn/tokidoki/debug"
|
||||||
)
|
)
|
||||||
|
|
||||||
type IMAPProvider struct {
|
type IMAPProvider struct {
|
||||||
@ -43,6 +45,7 @@ func (prov *IMAPProvider) doAuth(next http.Handler,
|
|||||||
|
|
||||||
conn, err := prov.dial()
|
conn, err := prov.dial()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
debug.Printf("Auth dial error: %v", err)
|
||||||
http.Error(w, "Temporary authentication error, try again later", http.StatusServiceUnavailable)
|
http.Error(w, "Temporary authentication error, try again later", http.StatusServiceUnavailable)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -50,6 +53,7 @@ func (prov *IMAPProvider) doAuth(next http.Handler,
|
|||||||
|
|
||||||
auth := sasl.NewPlainClient("", user, pass)
|
auth := sasl.NewPlainClient("", user, pass)
|
||||||
if err := conn.Authenticate(auth); err != nil {
|
if err := conn.Authenticate(auth); err != nil {
|
||||||
|
debug.Printf("Auth error: %v", err)
|
||||||
http.Error(w, "Invalid username or password", http.StatusUnauthorized)
|
http.Error(w, "Invalid username or password", http.StatusUnauthorized)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user