Skip to content

Commit 1b7427d

Browse files
committed
bug fix: permission
1 parent cbd3962 commit 1b7427d

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

.eslintrc.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"semi": [
2929
"warn",
3030
"always"
31-
]
31+
],
32+
"no-unused-vars": "warn"
3233
}
3334
}

constants.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ module.exports = {
77
PERM_THREAD_DELETE: 4,
88
PERM_REPLY_DELETE: 8,
99
PERM_ADMIN: 16,
10-
PERM_DEFAULT: 1 & 2
10+
PERM_DEFAULT: 1 | 2
1111
};

util/validator.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const
2+
RE_USERNAME = /[A-Za-z0-9_\-]{5,32}/i,
3+
RE_EMAIL = /\s+@\s+\.(com|net|org|cn|me)/i,
4+
RE_PASSWORD = /\s{8,32}/i,
5+
is = require('core-util-is'),
6+
isUsername = s => RE_USERNAME.test(s),
7+
isEmail = s => RE_EMAIL.test(s),
8+
isPassword = s => RE_PASSWORD.test(s);
9+
10+
module.exports = {
11+
isEmail, isPassword, isUsername
12+
};

0 commit comments

Comments
 (0)