Merge pull request #85 from vvalchev/logout_support

re-authentication support
This commit is contained in:
Bill Church 2018-07-30 08:20:04 -04:00 committed by GitHub
commit a518f0748f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View file

@ -35,6 +35,19 @@ app.disable('x-powered-by')
// static files
app.use(express.static(publicPath, expressOptions))
app.get('/reauth', function (req, res, next) {
var r = req.headers.referer || '/';
res.status(401).send(
'<html>' +
' <head>' +
' <meta http-equiv="refresh" content="1; url=' + r + '" />' +
' </head>' +
' <body>' +
' <a href="' + r + '">Go Back</a>' +
' </body>' +
'</html>');
})
app.get('/ssh/host/:host?', function (req, res, next) {
res.sendFile(path.join(path.join(publicPath, 'client.htm')))
// capture, assign, and validated variables

View file

@ -7,7 +7,9 @@ var SSH = require('ssh2').Client
// var fs = require('fs')
// var hostkeys = JSON.parse(fs.readFileSync('./hostkeyhashes.json', 'utf8'))
var termCols, termRows
var menuData = '<a id="logBtn"><i class="fas fa-clipboard fa-fw"></i> Start Log</a><a id="downloadLogBtn"><i class="fas fa-download fa-fw"></i> Download Log</a>'
var menuData = '<a id="logBtn"><i class="fas fa-clipboard fa-fw"></i> Start Log</a>' +
'<a id="downloadLogBtn"><i class="fas fa-download fa-fw"></i> Download Log</a>' +
'<a style="color:black" href="/reauth"><i class="fas fa-key fa-fw"></i> Switch User</a>';
// public
module.exports = function socket (socket) {