Merge pull request #658 from ericchiang/dev-dont-error-on-invalid-username

*: don't error out if a username doesn't exist in the backing connector
This commit is contained in:
Eric Chiang
2016-11-01 16:06:40 -07:00
committed by GitHub
3 changed files with 13 additions and 7 deletions

View File

@@ -218,8 +218,9 @@ func (db passwordDB) Login(email, password string) (connector.Identity, bool, er
if err != nil {
if err != storage.ErrNotFound {
log.Printf("get password: %v", err)
return connector.Identity{}, false, err
}
return connector.Identity{}, false, err
return connector.Identity{}, false, nil
}
if err := bcrypt.CompareHashAndPassword(p.Hash, []byte(password)); err != nil {
return connector.Identity{}, false, nil

View File

@@ -657,10 +657,10 @@ func TestPasswordDB(t *testing.T) {
},
},
{
name: "unknown user",
username: "john@example.com",
password: pw,
wantErr: true,
name: "unknown user",
username: "john@example.com",
password: pw,
wantInvalid: true,
},
{
name: "invalid password",