aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands
diff options
context:
space:
mode:
authormarzavec <admin@marzavec.com>2020-03-12 16:58:06 +0100
committerGitHub <noreply@github.com>2020-03-12 16:58:06 +0100
commit44ce7aa5dab2d9575f840056cc41712b57266c13 (patch)
treeb37089c2918727a57eaf39b2915fc67080b31ee6 /server/src/commands
parentMerge pull request #93 from MinusGix/inviteRework (diff)
parentMake password field available for use in join (diff)
downloadhackchat-44ce7aa5dab2d9575f840056cc41712b57266c13.tar.gz
hackchat-44ce7aa5dab2d9575f840056cc41712b57266c13.zip
Merge pull request #94 from MinusGix/joinPassword
Make password field available for use in join
Diffstat (limited to '')
-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>' }`,
};