From: Johannes Zellner Date: Thu, 9 Feb 2017 14:48:08 +0000 (+0100) Subject: Exit if username or password is empty X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2FNodejs%2FSurfer.git;a=commitdiff_plain;h=4eee848b4980beddbf5a66d045f2a2ad2fb31c02 Exit if username or password is empty --- 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) { var username = options.username || readlineSync.question('Username: '); var password = options.password || readlineSync.question('Password: ', { hideEchoBack: true, mask: '' }); + if (!username || !password) process.exit(1); + superagent.post(server + '/api/login').send({ username: username, password: password }).end(function (error, result) { if (error && error.code === 'ENOTFOUND') { console.log('Server %s not found.'.red, server.bold);