From 00be0c1b219ee74ca3e09e584d260f18e7f36aff Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sun, 20 Feb 2022 18:28:58 +0800 Subject: [PATCH] Fix login with email for ldap users (#18800) `authenticator.Authenticate` has assume the login name is not an email, but `username` maybe an email. So when we find the user via email address, we should use `user.LoginName` instead of `username` which is an email address. --- services/auth/signin.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/auth/signin.go b/services/auth/signin.go index a6f2d14b5c..1b5b7f5d2a 100644 --- a/services/auth/signin.go +++ b/services/auth/signin.go @@ -65,7 +65,7 @@ func UserSignIn(username, password string) (*user_model.User, *auth.Source, erro return nil, nil, smtp.ErrUnsupportedLoginType } - user, err := authenticator.Authenticate(user, username, password) + user, err := authenticator.Authenticate(user, user.LoginName, password) if err != nil { return nil, nil, err }