Improve dc.authenticate()'s error messages

This commit is contained in:
Hubert Hirtz 2020-11-25 13:40:55 +01:00 committed by Simon Ser
parent 7bfa4dafef
commit 943182de2f
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -775,7 +775,7 @@ func (dc *downstreamConn) authenticate(username, password string) error {
u, err := dc.srv.db.GetUser(username) u, err := dc.srv.db.GetUser(username)
if err != nil { if err != nil {
dc.logger.Printf("failed authentication for %q: %v", username, err) dc.logger.Printf("failed authentication for %q: user not found: %v", username, err)
return errAuthFailed return errAuthFailed
} }
@ -786,7 +786,7 @@ func (dc *downstreamConn) authenticate(username, password string) error {
err = bcrypt.CompareHashAndPassword([]byte(u.Password), []byte(password)) err = bcrypt.CompareHashAndPassword([]byte(u.Password), []byte(password))
if err != nil { if err != nil {
dc.logger.Printf("failed authentication for %q: %v", username, err) dc.logger.Printf("failed authentication for %q: wrong password: %v", username, err)
return errAuthFailed return errAuthFailed
} }