Skip to content

Commit 0f295ab

Browse files
zeripathlafriks
authored andcommitted
Only allow local login if password is non-empty (#5906)
1 parent 80098bd commit 0f295ab

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

models/login_source.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ func UserSignIn(username, password string) (*User, error) {
644644
if hasUser {
645645
switch user.LoginType {
646646
case LoginNoType, LoginPlain, LoginOAuth2:
647-
if user.ValidatePassword(password) {
647+
if user.IsPasswordSet() && user.ValidatePassword(password) {
648648
return user, nil
649649
}
650650

modules/lfs/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ func parseToken(authorization string) (*models.User, *models.Repository, string,
582582
if err != nil {
583583
return nil, nil, "basic", err
584584
}
585-
if !u.ValidatePassword(password) {
585+
if !u.IsPasswordSet() || !u.ValidatePassword(password) {
586586
return nil, nil, "basic", fmt.Errorf("Basic auth failed")
587587
}
588588
return u, nil, "basic", nil

0 commit comments

Comments
 (0)