Browse Source

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

for-closed-social
Lunny Xiao 7 years ago
committed by Bo-Yi Wu
parent
commit
19d889daa2
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      models/login_source.go

+ 6
- 1
models/login_source.go View File

@ -641,7 +641,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)

Loading…
Cancel
Save