From e06d2570aeac6be267f13bf84380b5fd4fdf5145 Mon Sep 17 00:00:00 2001 From: billchurch Date: Fri, 10 Feb 2017 08:23:06 -0500 Subject: [PATCH] Fixes issue #4 Add a test for a blank (not null) username. Also added feature to re-prompt for credentials if none are entered. --- index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.js b/index.js index 3263b55..a908ac7 100644 --- a/index.js +++ b/index.js @@ -40,6 +40,10 @@ app.use(express.static(__dirname + '/public')).use(function(req, res, next) { res.statusCode = 401; res.setHeader('WWW-Authenticate', 'Basic realm="WebSSH"'); res.end('Username and password required for web SSH service.'); + } else if (myAuth.name == "") { + res.statusCode = 401 + res.setHeader('WWW-Authenticate', 'Basic realm="WebSSH"'); + res.end('Username and password required for web SSH service.'); } else { config.user.name = myAuth.name; config.user.password = myAuth.pass;