Browse Source

add username_regex

pull/6/head
quank123wip 6 years ago
parent
commit
23c8b7dabf
  1. 3
      config-example.json
  2. 2
      utility.js

3
config-example.json

@ -121,5 +121,6 @@
"type": "like-google-fonts", "type": "like-google-fonts",
"url": "https://fonts.loli.net" "url": "https://fonts.loli.net"
}, },
"no_cdn": false "no_cdn": false,
"username_regex": "^[a-zA-Z0-9\\-\\_]+$"
} }

2
utility.js

@ -255,7 +255,7 @@ module.exports = {
return md5.digest('hex'); return md5.digest('hex');
}, },
isValidUsername(s) { isValidUsername(s) {
return /^[a-zA-Z0-9\-\_]+$/.test(s); return RegExp(syzoj.config.username_regex).test(s);
}, },
locks: [], locks: [],
lock(key, cb) { lock(key, cb) {

Loading…
Cancel
Save