Skip to content

Commit

Permalink
Merge pull request #85 from vvalchev/logout_support
Browse files Browse the repository at this point in the history
re-authentication support
  • Loading branch information
billchurch authored Jul 30, 2018
2 parents a1fdc09 + 29804c7 commit a518f07
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
13 changes: 13 additions & 0 deletions server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion server/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a518f07

Please sign in to comment.