Skip to content
Snippets Groups Projects
Unverified Commit a67881b0 authored by slice's avatar slice
Browse files

Check for websocket token before connecting to chat

Closes #403. Previously, a socket to the chat channel would be opened if
chat is enabled, regardless if the user is logged in or not. This patch
only allows a connection to be opened if a wsToken (websocket token) is
present, which prevents websocket errors from unauthenticated users.
parent 09736691
No related branches found
No related tags found
No related merge requests found
......@@ -50,7 +50,7 @@ const api = {
},
initializeSocket (store) {
// Set up websocket connection
if (!store.state.chatDisabled) {
if (!store.state.chatDisabled && store.state.wsToken) {
const token = store.state.wsToken
const socket = new Socket('/socket', {params: {token}})
socket.connect()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment