aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/utility
diff options
context:
space:
mode:
authorMinusGix <MinusGix@gmail.com>2020-03-06 21:41:09 +0100
committerMinusGix <MinusGix@gmail.com>2020-03-06 21:41:09 +0100
commiteec99669c8b6d08bf4153a58aa72dabd5aacdae0 (patch)
treede2f05d19fdbe74bc7ac6469316a399a3cbb003f /server/src/commands/utility
parentMinor UAC tweaks (diff)
downloadhackchat-eec99669c8b6d08bf4153a58aa72dabd5aacdae0.tar.gz
hackchat-eec99669c8b6d08bf4153a58aa72dabd5aacdae0.zip
Deduplicate verifyNickname into a single importable function
Diffstat (limited to 'server/src/commands/utility')
-rw-r--r--server/src/commands/utility/UAC/_info.js12
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