use new regex pattern for permissions

This commit is contained in:
Maren Süwer
2018-10-02 15:27:51 +02:00
parent a120b5af62
commit b7ed7e44dd
10 changed files with 153 additions and 81 deletions

View File

@@ -1,5 +1,5 @@
// @flow
const nameRegex = /^([A-z0-9.\-_@]|[^ ]([A-z0-9.\-_@ ]*[A-z0-9.\-_@]|[^\s])?)$/;
const nameRegex = /^[A-Za-z0-9\.\-_][A-Za-z0-9\.\-_@]*$/;
export const isNameValid = (name: string) => {
return nameRegex.test(name);

View File

@@ -5,6 +5,7 @@ describe("test name validation", () => {
it("should return false", () => {
// invalid names taken from ValidationUtilTest.java
const invalidNames = [
"@test",
" test 123",
" test 123 ",
"test 123 ",
@@ -35,10 +36,9 @@ describe("test name validation", () => {
"Test123-git",
"Test_user-123.git",
"test@scm-manager.de",
"test 123",
"test123",
"tt",
"t",
"valid_name",
"another1",
"stillValid",