aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/form-validators
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-08-23 15:49:16 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-08-23 15:49:16 +0200
commit9e8aa10d94e4642ec1d20a522c41b06e9df7758b (patch)
tree6c9b7bb4a211e000d3ccad95c6eed6ff827dd373 /client/src/app/shared/form-validators
parentb5d6b94c1e192cc7b6ace0e73fc8edee2dc510ef (diff)
downloadPeerTube-9e8aa10d94e4642ec1d20a522c41b06e9df7758b.tar.gz
PeerTube-9e8aa10d94e4642ec1d20a522c41b06e9df7758b.tar.zst
PeerTube-9e8aa10d94e4642ec1d20a522c41b06e9df7758b.zip
Client: change url validation for friend add
Diffstat (limited to 'client/src/app/shared/form-validators')
-rw-r--r--client/src/app/shared/form-validators/index.ts1
-rw-r--r--client/src/app/shared/form-validators/url.validator.ts11
2 files changed, 12 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 @@
1import { FormControl } from '@angular/forms';
2
3export 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}