Skip to content

Commit

Permalink
ks importuser password check
Browse files Browse the repository at this point in the history
  • Loading branch information
cmontag committed May 18, 2020
1 parent 7c4abde commit e9218c7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion api/keystore/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,12 @@ func (ks *Keystore) ImportUser(r *http.Request, args *ImportUserArgs, reply *Imp

ks.log.Verbo("ImportUser called for %s", args.Username)

if usr, err := ks.getUser(args.Username); err == nil || usr != nil {
usr, err := ks.getUser(args.Username)
switch {
case err == nil || usr != nil:
return fmt.Errorf("user already exists: %s", args.Username)
case !usr.CheckPassword(args.Password):
return fmt.Errorf("incorrect password for user %q", args.Username)
}

userData := UserDB{}
Expand Down

0 comments on commit e9218c7

Please sign in to comment.