diff options
Diffstat (limited to 'assets/js/main.js')
-rw-r--r-- | assets/js/main.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/assets/js/main.js b/assets/js/main.js index 51ace3b..79e0dd2 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -10,6 +10,9 @@ function parse_endpoint(val) { if (val.length == 0) { throw new Error('Server endpoint cannot be an empty string.'); } + if (!val.match(/^.+:[0-9]+$/)) { + throw new Error('Please specify a host and a port in the HOST:PORT format.'); + } return val; } @@ -18,6 +21,9 @@ function parse_key(val) { if (val.length == 0) { throw new Error('Key as used by WireGuard cannot be an empty string.'); } + if (!val.match(/^[0-9a-zA-Z+/=]+$/)) { + throw new Error('Key as used by WireGuard must be Base64-encoded.'); + } return val; } |