The provided patch, will add a /logout URL, which will re-request the authentication and then redirect you back to the referrer (e.g like http://localhost:2222/ssh/host/myhost.com).
It also adds a menu entry "Switch User" that opens /logout and forces re-authentication.
This commit is contained in:
parent
a1fdc0974d
commit
771800b02a
2 changed files with 16 additions and 1 deletions
|
@ -35,6 +35,19 @@ app.disable('x-powered-by')
|
|||
// static files
|
||||
app.use(express.static(publicPath, expressOptions))
|
||||
|
||||
app.get('/logout', 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
|
||||
|
|
|
@ -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="/logout"><i class="fas fa-key fa-fw"></i> Switch User</a>';
|
||||
|
||||
// public
|
||||
module.exports = function socket (socket) {
|
||||
|
|
Loading…
Reference in a new issue