From 584ed7510da42d2b79c33076eb958b1001f814e8 Mon Sep 17 00:00:00 2001 From: zijiren233 Date: Mon, 16 Oct 2023 16:58:03 +0800 Subject: [PATCH] Fix: create room no need pwd --- server/model/room.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/server/model/room.go b/server/model/room.go index 97913242..8198afc7 100644 --- a/server/model/room.go +++ b/server/model/room.go @@ -49,10 +49,12 @@ func (c *CreateRoomReq) Validate() error { return ErrRoomIdHasInvalidChar } - if len(c.Password) > 32 { - return ErrPasswordTooLong - } else if !alphaNumReg.MatchString(c.Password) { - return ErrPasswordHasInvalidChar + if c.Password != "" { + if len(c.Password) > 32 { + return ErrPasswordTooLong + } else if !alphaNumReg.MatchString(c.Password) { + return ErrPasswordHasInvalidChar + } } if c.Username == "" {