Commit bbe6aa34 authored by Lunny Xiao's avatar Lunny Xiao Committed by Bo-Yi Wu
Browse files

fix bug not to trim space of login username (#1806)

No related merge requests found
Showing with 6 additions and 1 deletion
+6 -1
...@@ -635,7 +635,12 @@ func UserSignIn(username, password string) (*User, error) { ...@@ -635,7 +635,12 @@ func UserSignIn(username, password string) (*User, error) {
} }
} }
} else { } 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) hasUser, err := x.Get(user)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment