Skip to content

Commit

Permalink
Fix login with email for ldap users (#18800) (#18836)
Browse files Browse the repository at this point in the history
`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>
  • Loading branch information
lunny and techknowlogick authored Feb 22, 2022
1 parent efc78c1 commit 6591f87
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion services/auth/signin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 6591f87

Please sign in to comment.