aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMarvin Borner2019-02-09 17:25:40 +0100
committerMarvin Borner2019-02-09 17:25:40 +0100
commit7b2d68dbe5f59e830458b30b47a293d3f818dc79 (patch)
tree37e70a753b4fe092dc3d73836c778bf3e93a712f
parent062b6437064cb14801f780561931b791362f74e2 (diff)
Added ID input check
-rw-r--r--public/scripts/chat.js21
1 files changed, 13 insertions, 8 deletions
diff --git a/public/scripts/chat.js b/public/scripts/chat.js
index a3f2fda..c875698 100644
--- a/public/scripts/chat.js
+++ b/public/scripts/chat.js
@@ -211,14 +211,19 @@ function chat() {
attributes: {
placeholder: 'Contact ID',
},
- }).then(contactId => connect(contactId).then(() => swal({
- title: 'Connecting...',
- icon: 'info',
- text: ' ',
- buttons: false,
- closeOnClickOutside: false,
- closeOnEsc: false
- })))
+ }).then(contactId => {
+ if (contactId.match(/^([a-zA-Z]*-[a-zA-Z]*)+$/)) {
+ connect(contactId).then(() => swal({
+ title: 'Connecting...',
+ icon: 'info',
+ text: ' ',
+ buttons: false,
+ closeOnClickOutside: false,
+ closeOnEsc: false
+ }))
+ } else
+ swal('Invalid ID!', '', 'error')
+ })
}
/**