Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ describe('ProfileFormComponent', () => {
[
'very long value very long value very long value very long value very long value very long value very long value',
'as&@3$',
'test/',
'test[',
':test',
].forEach(value => {
const name: HTMLInputElement = compiled.querySelector(
'.form-name'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class ProfileFormComponent implements OnInit, AfterViewInit {

group['name'] = new FormControl('', [
this.profileValidators.textRequired(),
this.deviceValidators.deviceStringFormat(),
this.profileValidators.profileNameFormat(),
this.nameValidator,
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ export class ProfileValidators {

readonly STRING_FORMAT_REGEXP = new RegExp('^[^"\\\\]*$', 'u');

// Not allowed symbols: <>?/:;@'"][=^!\#$%&*+{}|()
readonly PROFILE_NAME_FORMAT_REGEXP = new RegExp(
'^([^<>?:;@\'\\\\"\\[\\]=^!/,.#$%&*+{}|()]{1,28})$',
'u'
);

public differentProfileName(
profiles: Profile[],
profile: Profile | null
Expand Down Expand Up @@ -60,6 +66,10 @@ export class ProfileValidators {
};
}

public profileNameFormat(): ValidatorFn {
return this.stringFormat(this.PROFILE_NAME_FORMAT_REGEXP);
}

public multiSelectRequired(g: FormGroup) {
if (Object.values(g.value).every(value => value === false)) {
return { required: true };
Expand Down
Loading