Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

feat(user): replace space in username with -

LinkinStars69f250ee044c
diff --git a/internal/service/user_common/user.go b/internal/service/user_common/user.go
index 4a452584..0b419d4a 100644
--- a/internal/service/user_common/user.go
+++ b/internal/service/user_common/user.go
@@ -151,7 +151,7 @@ func (us *UserCommon) MakeUsername(ctx context.Context, displayName string) (use
}
}
- username = strings.ReplaceAll(displayName, " ", "_")
+ username = strings.ReplaceAll(displayName, " ", "-")
username = strings.ToLower(username)
suffix := ""
diff --git a/pkg/random/random_username.go b/pkg/random/random_username.go
index 3c8cb1de..35715f9a 100644
--- a/pkg/random/random_username.go
+++ b/pkg/random/random_username.go
@@ -1,8 +1,8 @@
package random
import (
+ "crypto/rand"
"encoding/hex"
- "math/rand"
)
func UsernameSuffix() string {