diff --git a/lib/Connection.js b/lib/Connection.js index bd31e98b..0cc9a4aa 100644 --- a/lib/Connection.js +++ b/lib/Connection.js @@ -1654,12 +1654,6 @@ Connection.prototype._login = function() { return; } - if (self.serverSupports('LOGINDISABLED')) { - err = new Error('Logging in is disabled on this server'); - err.source = 'authentication'; - return reentry(err); - } - var cmd; if (self.serverSupports('AUTH=XOAUTH') && self._config.xoauth) { self._caps = undefined; @@ -1675,6 +1669,11 @@ Connection.prototype._login = function() { cmd += ' ' + escape(self._config.xoauth2); self._enqueue(cmd, checkCaps); } else if (self._config.user && self._config.password) { + if (self.serverSupports('LOGINDISABLED')) { + err = new Error('Logging in is disabled on this server'); + err.source = 'authentication'; + return reentry(err); + } self._caps = undefined; self._enqueue('LOGIN "' + escape(self._config.user) + '" "' + escape(self._config.password) + '"', checkCaps);