@@ -348,8 +348,13 @@ module.exports = { | |||||
register: async function (msg) { | register: async function (msg) { | ||||
let credentials = msg.data; | let credentials = msg.data; | ||||
if ((credentials.username === '') || (credentials.password === '')) { | |||||
if (credentials.username === '' || credentials.password === '') { | |||||
msg.callback(messages.login.allFields); | msg.callback(messages.login.allFields); | ||||
return; | |||||
} else if (credentials.username.length > 32) { | |||||
msg.callback(messages.login.maxUsernameLength); | |||||
return; | return; | ||||
} | } | ||||
@@ -86,7 +86,7 @@ module.exports = { | |||||
return; | return; | ||||
let source = cons.players.find(c => c.id === sourceId); | let source = cons.players.find(c => c.id === sourceId); | ||||
if (!source) | |||||
if (!source || !source.social) | |||||
return; | return; | ||||
source.social.sendMessage('invite sent', 'color-yellowB'); | source.social.sendMessage('invite sent', 'color-yellowB'); | ||||
@@ -5,7 +5,8 @@ module.exports = { | |||||
allFields: 'please complete all fields', | allFields: 'please complete all fields', | ||||
illegal: 'illegal characters in username', | illegal: 'illegal characters in username', | ||||
incorrect: 'invalid username and password', | incorrect: 'invalid username and password', | ||||
charExists: 'character name is taken' | |||||
charExists: 'character name is taken', | |||||
maxUsernameLength: 'username may not be longer than 32 characters' | |||||
}, | }, | ||||
createCharacter: { | createCharacter: { | ||||
nameLength: 'name must be between 3 and 12 characters' | nameLength: 'name must be between 3 and 12 characters' | ||||