Improve the events triggered on failed authentication

Trigger failed_auth as before, once for each failed method
Trigger failed_all_auth once all method failed
Trigger no_auth only if we couldn’t even try one method
This commit is contained in:
Florent Le Coz 2014-08-01 03:16:22 +02:00
parent 73edd42774
commit 93934c7992

View file

@ -172,8 +172,11 @@ class FeatureMechanisms(BasePlugin):
min_mech=self.min_mech)
except sasl.SASLNoAppropriateMechanism:
log.error("No appropriate login method.")
self.xmpp.event("no_auth")
self.xmpp.event("failed_auth")
self.xmpp.event("failed_all_auth")
if not self.attempted_mechs:
# Only trigger this event if we didn't try at least one
# method
self.xmpp.event("no_auth")
self.attempted_mechs = set()
return self.xmpp.disconnect()
except StringPrepError: