diff options
author | Johannes Zellner <johannes@cloudron.io> | 2017-02-09 15:48:08 +0100 |
---|---|---|
committer | Johannes Zellner <johannes@cloudron.io> | 2017-02-09 15:48:08 +0100 |
commit | 4eee848b4980beddbf5a66d045f2a2ad2fb31c02 (patch) | |
tree | d41ed29c901e86036fa8acf69afb9594a0d7d655 | |
parent | ff4aca50745b4fa09db75afaea8240af992ead21 (diff) | |
download | Surfer-4eee848b4980beddbf5a66d045f2a2ad2fb31c02.tar.gz Surfer-4eee848b4980beddbf5a66d045f2a2ad2fb31c02.tar.zst Surfer-4eee848b4980beddbf5a66d045f2a2ad2fb31c02.zip |
Exit if username or password is empty
-rw-r--r-- | cli/actions.js | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/cli/actions.js b/cli/actions.js index e9bbd9d..2440c2d 100644 --- a/cli/actions.js +++ b/cli/actions.js | |||
@@ -66,6 +66,8 @@ function login(uri, options) { | |||
66 | var username = options.username || readlineSync.question('Username: '); | 66 | var username = options.username || readlineSync.question('Username: '); |
67 | var password = options.password || readlineSync.question('Password: ', { hideEchoBack: true, mask: '' }); | 67 | var password = options.password || readlineSync.question('Password: ', { hideEchoBack: true, mask: '' }); |
68 | 68 | ||
69 | if (!username || !password) process.exit(1); | ||
70 | |||
69 | superagent.post(server + '/api/login').send({ username: username, password: password }).end(function (error, result) { | 71 | superagent.post(server + '/api/login').send({ username: username, password: password }).end(function (error, result) { |
70 | if (error && error.code === 'ENOTFOUND') { | 72 | if (error && error.code === 'ENOTFOUND') { |
71 | console.log('Server %s not found.'.red, server.bold); | 73 | console.log('Server %s not found.'.red, server.bold); |