aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMinusGix <MinusGix@gmail.com>2020-03-07 00:45:47 +0100
committerMinusGix <MinusGix@gmail.com>2020-03-07 00:45:47 +0100
commit30d1dbc1c636fae86c5c52e1ccf013cf605e8a2b (patch)
tree8245471716c430b6fcf9b4816e40972a08d39df5
parentMerge pull request #92 from MinusGix/tripInfo (diff)
downloadhackchat-30d1dbc1c636fae86c5c52e1ccf013cf605e8a2b.tar.gz
hackchat-30d1dbc1c636fae86c5c52e1ccf013cf605e8a2b.zip
Make password field available for use in join
-rw-r--r--server/src/commands/core/join.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/server/src/commands/core/join.js b/server/src/commands/core/join.js
index 7e98721..ddbdf6d 100644
--- a/server/src/commands/core/join.js
+++ b/server/src/commands/core/join.js
@@ -32,7 +32,13 @@ export function parseNickname(core, data) {
return 'Nickname must consist of up to 24 letters, numbers, and underscores';
}
- const password = nickArray[1];
+ let password = undefined;
+ // prioritize hash in nick for password over password field
+ if (typeof nickArray[1] === 'string') {
+ password = nickArray[1];
+ } else if (typeof data.password === 'string') {
+ password = data.password;
+ }
if (hash(password + core.config.tripSalt) === core.config.adminTrip) {
userInfo.uType = 'admin';
@@ -152,5 +158,5 @@ export const info = {
name: 'join',
description: 'Place calling socket into target channel with target nick & broadcast event to channel',
usage: `
- API: { cmd: 'join', nick: '<your nickname>', channel: '<target channel>' }`,
+ API: { cmd: 'join', nick: '<your nickname>', password: '<optional password>', channel: '<target channel>' }`,
};