diff options
author | Marvin Borner | 2019-02-09 17:25:40 +0100 |
---|---|---|
committer | Marvin Borner | 2019-02-09 17:25:40 +0100 |
commit | 7b2d68dbe5f59e830458b30b47a293d3f818dc79 (patch) | |
tree | 37e70a753b4fe092dc3d73836c778bf3e93a712f | |
parent | 062b6437064cb14801f780561931b791362f74e2 (diff) |
Added ID input check
-rw-r--r-- | public/scripts/chat.js | 21 |
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') + }) } /** |