Skip to content

Commit 7b49a0d

Browse files
committed
pr comments
1 parent 3339273 commit 7b49a0d

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

coderd/userauth.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,10 @@ func (api *API) oauthLogin(r *http.Request, params oauthLoginParams) (*http.Cook
400400
validUsername bool
401401
)
402402
for i := 0; i < 10; i++ {
403-
params.Username = fmt.Sprintf("%s_%s", original, namesgenerator.GetRandomName(10))
403+
alternate := fmt.Sprintf("%s_%s", original, namesgenerator.GetRandomName(1))
404+
405+
params.Username = httpapi.UsernameFrom(alternate)
406+
404407
_, err := tx.GetUserByEmailOrUsername(ctx, database.GetUserByEmailOrUsernameParams{
405408
Username: params.Username,
406409
})

coderd/userauth_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ func TestUserOIDC(t *testing.T) {
449449
tc := tc
450450
t.Run(tc.Name, func(t *testing.T) {
451451
t.Parallel()
452-
conf := coderdtest.NewFakeOIDCConfig(t, "")
452+
conf := coderdtest.NewOIDCConfig(t, "")
453453

454454
config := conf.OIDCConfig()
455455
config.AllowSignups = tc.AllowSignups
@@ -482,7 +482,7 @@ func TestUserOIDC(t *testing.T) {
482482
t.Run("AlternateUsername", func(t *testing.T) {
483483
t.Parallel()
484484

485-
conf := coderdtest.NewFakeOIDCConfig(t, "")
485+
conf := coderdtest.NewOIDCConfig(t, "")
486486

487487
config := conf.OIDCConfig()
488488
config.AllowSignups = true

0 commit comments

Comments
 (0)