mirror of
https://github.com/usememos/memos.git
synced 2025-03-09 20:13:46 +08:00
fix: check username in signup
This commit is contained in:
parent
ab136e3310
commit
606a30640d
1 changed files with 3 additions and 0 deletions
|
@ -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{
|
||||||
|
|
Loading…
Reference in a new issue