Disallowing non-alphanumeric usernames

This commit is contained in:
James Barnsley
2017-02-17 21:36:31 +13:00
parent 16d057cd17
commit 639bcbcbce
4 changed files with 18 additions and 10 deletions

View File

@ -90,11 +90,12 @@ const PusherMiddleware = (function(){
var state = store.getState();
var connection = {
clientid: Math.random().toString(36).substr(2, 9),
clientid: helpers.generateGuid(),
connectionid: helpers.generateGuid(),
username: Math.random().toString(36).substr(2, 9)
username: 'Anonymous'
}
if( state.pusher.username ) connection.username = state.pusher.username;
connection.username = connection.username.replace(/\W/g, '')
socket = new WebSocket(
'ws://'+state.mopidy.host+':'+state.mopidy.port+'/iris/ws',