summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2014-08-01 03:16:22 +0200
committerFlorent Le Coz <louiz@louiz.org>2014-08-01 03:16:22 +0200
commit93934c799233eb7ae213b1f7c8490635d5b6ee83 (patch)
treebabf29aee3edb9a089e26bd7cb38799892774b33
parent73edd427740cbc92859863acf9a772f84710c59e (diff)
downloadslixmpp-93934c799233eb7ae213b1f7c8490635d5b6ee83.tar.gz
slixmpp-93934c799233eb7ae213b1f7c8490635d5b6ee83.tar.bz2
slixmpp-93934c799233eb7ae213b1f7c8490635d5b6ee83.tar.xz
slixmpp-93934c799233eb7ae213b1f7c8490635d5b6ee83.zip
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
-rw-r--r--slixmpp/features/feature_mechanisms/mechanisms.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/slixmpp/features/feature_mechanisms/mechanisms.py b/slixmpp/features/feature_mechanisms/mechanisms.py
index fe38fbd5..5f947cfa 100644
--- a/slixmpp/features/feature_mechanisms/mechanisms.py
+++ b/slixmpp/features/feature_mechanisms/mechanisms.py
@@ -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: