1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-16 00:06:40 +01:00

Allow underscores in name validation

This commit is contained in:
Clint Brown 2017-09-19 14:37:23 +10:00
parent 3f4303a49d
commit b4084aa705

View File

@ -103,8 +103,8 @@ module.exports.router = function(config) {
router.post('/validate', (req, res) => {
req.checkBody('name', 'Name is required').notEmpty();
req
.checkBody('name', 'Name must match format ^[0-9a-zA-Z\\.\\-]+$')
.matches(/^[0-9a-zA-Z\\.\\-]+$/i);
.checkBody('name', 'Name must match format ^[0-9a-zA-Z\\.\\-\\_]+$')
.matches(/^[0-9a-zA-Z\\.\\-\\_]+$/i);
validateRequest(req)
.then(validateUniqueName)
@ -115,8 +115,8 @@ module.exports.router = function(config) {
router.post('/', (req, res) => {
req.checkBody('name', 'Name is required').notEmpty();
req
.checkBody('name', 'Name must match format ^[0-9a-zA-Z\\.\\-]+$')
.matches(/^[0-9a-zA-Z\\.\\-]+$/i);
.checkBody('name', 'Name must match format ^[0-9a-zA-Z\\.\\-\\_]+$')
.matches(/^[0-9a-zA-Z\\.\\-\\_]+$/i);
const userName = extractUser(req);
validateRequest(req)