Skip to content

Commit

Permalink
Update username validation logic
Browse files Browse the repository at this point in the history
This commit changes the validation logic for the username in auth.go. The username validation is now only performed if the query mode isn't 'list-accounts', enhancing the flexibility of the validation process.

Signed-off-by: Christian Roessner <[email protected]>
  • Loading branch information
Christian Roessner committed May 28, 2024
1 parent de9c1a9 commit 20fba9e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions server/core/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -2080,10 +2080,12 @@ func setupAuth(ctx *gin.Context, auth *Authentication) {
setupHTTPBasiAuth(ctx, auth)
}

if !util.ValidateUsername(auth.Username) {
auth.Username = ""
if ctx.Query("mode") != "list-accounts" {
if !util.ValidateUsername(auth.Username) {
auth.Username = ""

ctx.Error(errors2.ErrInvalidUsername)
ctx.Error(errors2.ErrInvalidUsername)
}
}

auth.withDefaults(ctx)
Expand Down

0 comments on commit 20fba9e

Please sign in to comment.