aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2022-02-23 07:04:57 +0800
committerGitHub <noreply@github.com>2022-02-22 18:04:57 -0500
commit6591f87b28edbdf25ac16985f6aa1a190f7ba2e8 (patch)
treea71da4bd5c9d35ccff33eef73314fe29ee089cd5
parentefc78c18c12e00883d50f6272df5ad11622b59c4 (diff)
downloadgitea-6591f87b28edbdf25ac16985f6aa1a190f7ba2e8.tar.gz
gitea-6591f87b28edbdf25ac16985f6aa1a190f7ba2e8.zip
Fix login with email for ldap users (#18800) (#18836)
`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. Co-authored-by: techknowlogick <techknowlogick@gitea.io>
-rw-r--r--services/auth/signin.go2
1 files changed, 1 insertions, 1 deletions
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
}