Commit 606a3064 authored by Steven's avatar Steven

fix: check username in signup

parent ab136e33
...@@ -189,6 +189,9 @@ func (s *APIV2Service) SignUp(ctx context.Context, request *apiv2pb.SignUpReques ...@@ -189,6 +189,9 @@ func (s *APIV2Service) SignUp(ctx context.Context, request *apiv2pb.SignUpReques
Nickname: request.Username, Nickname: request.Username,
PasswordHash: string(passwordHash), PasswordHash: string(passwordHash),
} }
if !util.ResourceNameMatcher.MatchString(strings.ToLower(create.Username)) {
return nil, status.Errorf(codes.InvalidArgument, "invalid username: %s", create.Username)
}
hostUserType := store.RoleHost hostUserType := store.RoleHost
existedHostUsers, err := s.Store.ListUsers(ctx, &store.FindUser{ existedHostUsers, err := s.Store.ListUsers(ctx, &store.FindUser{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment