Don't allow names that are the access pin

If a user tries to enter the pin as their name return an error instead
of accepting the name.
This commit is contained in:
Zorchenhimer 2019-11-30 10:27:06 -05:00
parent 8fc3f86135
commit 7feb277a33
1 changed files with 5 additions and 0 deletions

View File

@ -59,6 +59,11 @@ func (cr *ChatRoom) Join(conn *chatConnection, data common.JoinData) (*Client, e
}
}
if settings.RoomAccess == AccessPin && data.Name == settings.RoomAccessPin {
sendHiddenMessage(common.CdNotify, "That's the access pin! Please enter a name.")
return nil, UserFormatError{Name: data.Name}
}
if !common.IsValidName(data.Name) {
sendHiddenMessage(common.CdNotify, common.InvalidNameError)
return nil, UserFormatError{Name: data.Name}