Skip to content

Commit

Permalink
Merge pull request #48 from krnekit/sasl-errors
Browse files Browse the repository at this point in the history
Added SASL error type
  • Loading branch information
chris-rock committed Jun 6, 2014
2 parents 21680be + bc1d66b commit 9dcc531
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/c2s/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,13 @@ C2SStream.prototype.sendAuthError = function(error) {
if (this.jid) {
this.emit('auth-failure', this.jid)
}
var message = error ? error.message : 'Authentication failure'
var message = error && error.message ? error.message : 'Authentication failure'
var type = error && error.type ? error.type : 'not-authorized'
this.send(new ltx.Element('failure', {
xmlns: NS_XMPP_SASL
}).c('text').t(message))
})
.c(type).up()
.c('text').t(message))
}

C2SStream.prototype.onAuth = function(stanza) {
Expand Down

0 comments on commit 9dcc531

Please sign in to comment.