Fix not checking for user credentials upon login (#9)

This commit is contained in:
konrad 2018-11-01 22:51:05 +00:00 committed by Gitea
parent 4713023a97
commit 9a5eb577b8

View file

@ -74,6 +74,11 @@ func GetUser(user User) (userOut User, err error) {
// CheckUserCredentials checks user credentials
func CheckUserCredentials(u *UserLogin) (User, error) {
// Check if we have any credentials
if u.Password == "" || u.Username == "" {
return User{}, ErrNoUsernamePassword{}
}
// Check if the user exists
user, err := GetUser(User{Username: u.Username})
if err != nil {