Skip to content

Commit

Permalink
User-visible errors polish
Browse files Browse the repository at this point in the history
Fixes #1779
  • Loading branch information
kontsevoy authored and russjones committed Mar 27, 2018
1 parent ced29ea commit 538515c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/auth/new_web_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (s *AuthServer) CreateSignupToken(userv1 services.UserV1, ttl time.Duration
// when unable to.
_, err := s.GetPasswordHash(user.GetName())
if err == nil {
return "", trace.BadParameter("user %q already exists", user)
return "", trace.BadParameter("user '%s' already exists", user.GetName())
}

token, err := utils.CryptoRandomHex(TokenLenBytes)
Expand Down Expand Up @@ -142,7 +142,7 @@ func (s *AuthServer) GetSignupTokenData(token string) (user string, qrCode []byt
// It's a TOCTOU bug in the making: https://en.wikipedia.org/wiki/Time_of_check_to_time_of_use
_, err = s.GetPasswordHash(tokenData.User.Name)
if err == nil {
return "", nil, trace.Errorf("can't add user %v: user already exists", tokenData.User)
return "", nil, trace.Errorf("user %q already exists", tokenData.User.Name)
}

return tokenData.User.Name, tokenData.OTPQRCode, nil
Expand All @@ -166,7 +166,7 @@ func (s *AuthServer) CreateSignupU2FRegisterRequest(token string) (u2fRegisterRe

_, err = s.GetPasswordHash(tokenData.User.Name)
if err == nil {
return nil, trace.AlreadyExists("can't add user %q, user already exists", tokenData.User)
return nil, trace.AlreadyExists("user %q already exists", tokenData.User.Name)
}

c, err := u2f.NewChallenge(universalSecondFactor.AppID, universalSecondFactor.Facets)
Expand Down
2 changes: 1 addition & 1 deletion lib/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ func (process *TeleportProcess) initAuthService() error {
srv.SetAddr(net.JoinHostPort(ip.String(), port))
}
}
log.Warnf("Parameter advertise_ip is not set for this auth server. Trying to guess the IP this server can be reached at: %v.", srv.GetAddr())
log.Warnf("auth_service: advertise_ip is not set. guessing %v.", srv.GetAddr())
}
// immediately register, and then keep repeating in a loop:
ticker := time.NewTicker(defaults.ServerHeartbeatTTL / 2)
Expand Down

0 comments on commit 538515c

Please sign in to comment.