diff --git a/group/group.go b/group/group.go index f4b1702..11a5569 100644 --- a/group/group.go +++ b/group/group.go @@ -22,6 +22,7 @@ var UseMDNS bool var UDPMin, UDPMax uint16 var ErrNotAuthorised = errors.New("not authorised") +var ErrAnonymousNotAuthorised = errors.New("anonymous users not authorised in this group") type UserError string @@ -966,7 +967,7 @@ func GetDescription(name string) (*Description, error) { func (desc *Description) GetPermission(group string, c Challengeable) (ClientPermissions, error) { var p ClientPermissions if !desc.AllowAnonymous && c.Username() == "" { - return p, UserError("anonymous users not allowed in this group, please choose a username") + return p, ErrAnonymousNotAuthorised } if found, good := matchClient(group, c, desc.Op); found { if good { diff --git a/rtpconn/webclient.go b/rtpconn/webclient.go index 4147638..1d05b86 100644 --- a/rtpconn/webclient.go +++ b/rtpconn/webclient.go @@ -1351,6 +1351,8 @@ func handleClientMessage(c *webClient, m clientMessage) error { } else if err == group.ErrNotAuthorised { s = "not authorised" time.Sleep(200 * time.Millisecond) + } else if err == group.ErrAnonymousNotAuthorised { + s = "please choose a username" } else if e, ok := err.(group.UserError); ok { s = string(e) } else {