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.
This commit is contained in:
		
					parent
					
						
							
								d5a4c5530a
							
						
					
				
			
			
				commit
				
					
						00be0c1b21
					
				
			
		
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
					@ -65,7 +65,7 @@ func UserSignIn(username, password string) (*user_model.User, *auth.Source, erro
 | 
				
			||||||
			return nil, nil, smtp.ErrUnsupportedLoginType
 | 
								return nil, nil, smtp.ErrUnsupportedLoginType
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		user, err := authenticator.Authenticate(user, username, password)
 | 
							user, err := authenticator.Authenticate(user, user.LoginName, password)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, nil, err
 | 
								return nil, nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue