diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-08-23 15:49:16 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-08-23 15:49:16 +0200 |
commit | 9e8aa10d94e4642ec1d20a522c41b06e9df7758b (patch) | |
tree | 6c9b7bb4a211e000d3ccad95c6eed6ff827dd373 /client/src/app/shared | |
parent | b5d6b94c1e192cc7b6ace0e73fc8edee2dc510ef (diff) | |
download | PeerTube-9e8aa10d94e4642ec1d20a522c41b06e9df7758b.tar.gz PeerTube-9e8aa10d94e4642ec1d20a522c41b06e9df7758b.tar.zst PeerTube-9e8aa10d94e4642ec1d20a522c41b06e9df7758b.zip |
Client: change url validation for friend add
Diffstat (limited to 'client/src/app/shared')
-rw-r--r-- | client/src/app/shared/form-validators/index.ts | 1 | ||||
-rw-r--r-- | client/src/app/shared/form-validators/url.validator.ts | 11 | ||||
-rw-r--r-- | client/src/app/shared/index.ts | 1 |
3 files changed, 13 insertions, 0 deletions
diff --git a/client/src/app/shared/form-validators/index.ts b/client/src/app/shared/form-validators/index.ts new file mode 100644 index 000000000..f9e9a6191 --- /dev/null +++ b/client/src/app/shared/form-validators/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './url.validator'; | |||
diff --git a/client/src/app/shared/form-validators/url.validator.ts b/client/src/app/shared/form-validators/url.validator.ts new file mode 100644 index 000000000..67163b4e9 --- /dev/null +++ b/client/src/app/shared/form-validators/url.validator.ts | |||
@@ -0,0 +1,11 @@ | |||
1 | import { FormControl } from '@angular/forms'; | ||
2 | |||
3 | export function validateUrl(c: FormControl) { | ||
4 | let URL_REGEXP = new RegExp('^https?://(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$'); | ||
5 | |||
6 | return URL_REGEXP.test(c.value) ? null : { | ||
7 | validateUrl: { | ||
8 | valid: false | ||
9 | } | ||
10 | }; | ||
11 | } | ||
diff --git a/client/src/app/shared/index.ts b/client/src/app/shared/index.ts index c05e8d253..9edf9b4a0 100644 --- a/client/src/app/shared/index.ts +++ b/client/src/app/shared/index.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | export * from './auth'; | 1 | export * from './auth'; |
2 | export * from './form-validators'; | ||
2 | export * from './search'; | 3 | export * from './search'; |
3 | export * from './users'; | 4 | export * from './users'; |