aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-11-27 17:45:00 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-11-27 17:45:00 +0100
commit447fde277497dfff73310dc12bf79fb576139b94 (patch)
treeb01e98543f71e3f3db9ceb8feb6b7fdddb69fcb1 /client
parent437cf8b531652a4b101ec279dea7661e8dfb8cda (diff)
downloadPeerTube-447fde277497dfff73310dc12bf79fb576139b94.tar.gz
PeerTube-447fde277497dfff73310dc12bf79fb576139b94.tar.zst
PeerTube-447fde277497dfff73310dc12bf79fb576139b94.zip
Client: improve host regex
Diffstat (limited to 'client')
-rw-r--r--client/src/app/admin/friends/friend-add/friend-add.component.ts9
-rw-r--r--client/src/app/shared/forms/form-validators/host.validator.ts5
2 files changed, 6 insertions, 8 deletions
diff --git a/client/src/app/admin/friends/friend-add/friend-add.component.ts b/client/src/app/admin/friends/friend-add/friend-add.component.ts
index 22b0241b4..014252011 100644
--- a/client/src/app/admin/friends/friend-add/friend-add.component.ts
+++ b/client/src/app/admin/friends/friend-add/friend-add.component.ts
@@ -83,13 +83,8 @@ export class FriendAddComponent implements OnInit {
83 83
84 this.friendService.makeFriends(notEmptyHosts).subscribe( 84 this.friendService.makeFriends(notEmptyHosts).subscribe(
85 status => { 85 status => {
86 // TODO: extractdatastatus 86 alert('Make friends request sent!');
87 // if (status === 409) { 87 this.router.navigate([ '/admin/friends/list' ]);
88 // alert('Already made friends!');
89 // } else {
90 alert('Make friends request sent!');
91 this.router.navigate([ '/admin/friends/list' ]);
92 // }
93 }, 88 },
94 error => alert(error.text) 89 error => alert(error.text)
95 ); 90 );
diff --git a/client/src/app/shared/forms/form-validators/host.validator.ts b/client/src/app/shared/forms/form-validators/host.validator.ts
index 9cb46d361..ea3e43cb1 100644
--- a/client/src/app/shared/forms/form-validators/host.validator.ts
+++ b/client/src/app/shared/forms/form-validators/host.validator.ts
@@ -1,7 +1,10 @@
1import { FormControl } from '@angular/forms'; 1import { FormControl } from '@angular/forms';
2 2
3export function validateHost(c: FormControl) { 3export function validateHost(c: FormControl) {
4 let HOST_REGEXP = new RegExp('^(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$'); 4 // Thanks to http://stackoverflow.com/a/106223
5 let HOST_REGEXP = new RegExp(
6 '^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$'
7 );
5 8
6 return HOST_REGEXP.test(c.value) ? null : { 9 return HOST_REGEXP.test(c.value) ? null : {
7 validateHost: { 10 validateHost: {