Require authentication to participate in chat (#4762)
* feat(chat): require authentication to participate in chat * fix: it's pretty much impossible to bypass the auth requirement, addressing review feedback anyway * feat(chat): render chat text input as disabled if chat auth is required * Commit updated API documentation --------- Co-authored-by: Owncast <owncast@owncast.online>
This commit is contained in:
@@ -397,6 +397,14 @@ func (s *Server) eventReceived(event chatClientEvent) {
|
||||
return
|
||||
}
|
||||
|
||||
// Check if authentication is required for chat
|
||||
if configRepository.GetChatRequireAuthentication() {
|
||||
if u == nil || (!u.Authenticated && !u.IsModerator()) {
|
||||
s.sendActionToClient(c, "Authentication is required to participate in chat.")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
var typecheck map[string]interface{}
|
||||
if err := json.Unmarshal(event.data, &typecheck); err != nil {
|
||||
log.Debugln(err)
|
||||
|
||||
Reference in New Issue
Block a user