Fixes #112 - Re-auth doesn't work if incorrect auth was provided initially.

https://github.com/billchurch/WebSSH2/issues/112

This commit send 'reauth' command to the client, when err.level === 'client-authentication'.

The client itself binds the 'reauthSession' function to that command, so it will automatically request authentication, every time the authentication fails.

The client bundle (webpack) is also rebuild with the made changes.
This commit is contained in:
Valentin Valchev 2018-10-11 11:18:01 +03:00
parent 238208cb53
commit a18efd20ad
3 changed files with 5 additions and 1 deletions

File diff suppressed because one or more lines are too long

View file

@ -156,6 +156,8 @@ socket.on('error', function (err) {
} }
}) })
socket.on('reauth',reauthSession)
term.on('title', function (title) { term.on('title', function (title) {
document.title = title document.title = title
}) })

View file

@ -152,6 +152,8 @@ module.exports = function socket (socket) {
console.log('WebSSH2 ' + 'error: Authentication failure'.red.bold + console.log('WebSSH2 ' + 'error: Authentication failure'.red.bold +
' user=' + socket.request.session.username.yellow.bold.underline + ' user=' + socket.request.session.username.yellow.bold.underline +
' from=' + socket.handshake.address.yellow.bold.underline) ' from=' + socket.handshake.address.yellow.bold.underline)
socket.emit('reauth')
} else { } else {
console.log('WebSSH2 Logout: user=' + socket.request.session.username + ' from=' + socket.handshake.address + ' host=' + socket.request.session.ssh.host + ' port=' + socket.request.session.ssh.port + ' sessionID=' + socket.request.sessionID + '/' + socket.id + ' allowreplay=' + socket.request.session.ssh.allowreplay + ' term=' + socket.request.session.ssh.term) console.log('WebSSH2 Logout: user=' + socket.request.session.username + ' from=' + socket.handshake.address + ' host=' + socket.request.session.ssh.host + ' port=' + socket.request.session.ssh.port + ' sessionID=' + socket.request.sessionID + '/' + socket.id + ' allowreplay=' + socket.request.session.ssh.allowreplay + ' term=' + socket.request.session.ssh.term)
if (err) { if (err) {