Skip to content

Commit

Permalink
simplify logic and avoid panics
Browse files Browse the repository at this point in the history
  • Loading branch information
fmartingr committed Apr 22, 2024
1 parent 4024790 commit 49ece26
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions api/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,14 +400,14 @@ func NewControllerWrapper(config *loadtest.Config, controllerConfig interface{},
// Check if the user has a custom authentication type. Custom authentication types are
// specified by prepending the username with the authentication type followed by a colon.
// Example: "openid:[email protected] user1password"
if strings.Contains(username, ":") {
usernameParts := strings.Split(username, ":")
if usernameParts := strings.Split(username, ":"); len(usernameParts) > 1 {
authenticationType = usernameParts[0]
username = usernameParts[1]

// Fix the email as well
emailParts := strings.Split(email, ":")
email = emailParts[1]
if emailParts := strings.Split(email, ":"); len(emailParts) > 1 {
email = emailParts[1]
}
}
}

Expand Down

0 comments on commit 49ece26

Please sign in to comment.