diff options
author | marzavec <admin@marzavec.com> | 2020-03-06 22:11:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-06 22:11:19 +0100 |
commit | 05436fa4dcc8e511468b840bf3e9fbe03a0088cb (patch) | |
tree | de2f05d19fdbe74bc7ac6469316a399a3cbb003f /server/src/commands/utility/UAC | |
parent | Minor UAC tweaks (diff) | |
parent | Deduplicate verifyNickname into a single importable function (diff) | |
download | hackchat-05436fa4dcc8e511468b840bf3e9fbe03a0088cb.tar.gz hackchat-05436fa4dcc8e511468b840bf3e9fbe03a0088cb.zip |
Merge pull request #90 from MinusGix/verifyNicknameMove
Deduplicate verifyNickname into a single importable function
Diffstat (limited to '')
-rw-r--r-- | server/src/commands/utility/UAC/_info.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/server/src/commands/utility/UAC/_info.js b/server/src/commands/utility/UAC/_info.js index 6da85d5..d34a384 100644 --- a/server/src/commands/utility/UAC/_info.js +++ b/server/src/commands/utility/UAC/_info.js @@ -1,6 +1,6 @@ /** * User Account Control information containing level constants - * and simple helper functions used to verify permissions + * and simple helper functions related to users * @property {Object} levels - Defines labels for default permission ranges * @author MinusGix ( https://github.com/MinusGix ) * @version v1.0.0 @@ -83,3 +83,13 @@ export function isChannelTrusted(level) { export function isTrustedUser(level) { return level >= levels.trustedUser; } + +/** + * Returns true if the nickname is valid + * @public + * @param {String} nick + * @return {boolean} + */ +export function verifyNickname (nick) { + return /^[a-zA-Z0-9_]{1,24}$/.test(nick); +}
\ No newline at end of file |