aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
Diffstat (limited to 'models')
-rw-r--r--models/login_source.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/models/login_source.go b/models/login_source.go
index 401bbf6714..b314253185 100644
--- a/models/login_source.go
+++ b/models/login_source.go
@@ -635,7 +635,12 @@ func UserSignIn(username, password string) (*User, error) {
}
}
} else {
- user = &User{LowerName: strings.ToLower(strings.TrimSpace(username))}
+ trimmedUsername := strings.TrimSpace(username)
+ if len(trimmedUsername) == 0 {
+ return nil, ErrUserNotExist{0, username, 0}
+ }
+
+ user = &User{LowerName: strings.ToLower(trimmedUsername)}
}
hasUser, err := x.Get(user)