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

Allow underscores in name validation

This commit is contained in:
Clint Brown 2017-09-19 14:37:23 +10:00 committed by Ivar Conradi Østhus
parent eaef5df24b
commit 3e7098578b

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)