summaryrefslogtreecommitdiff
path: root/sleekxmpp/features/feature_mechanisms/mechanisms.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-01-21 00:19:59 -0800
committerLance Stout <lancestout@gmail.com>2012-01-21 00:19:59 -0800
commitf81fb6af4403cacddf81081cee2273b657a8aae5 (patch)
treeca9878a00f1c11f571243b8740507b7fb8fd96e9 /sleekxmpp/features/feature_mechanisms/mechanisms.py
parentbb0a5186d67611fa78c2e7a78746ef1edef2929c (diff)
downloadslixmpp-f81fb6af4403cacddf81081cee2273b657a8aae5.tar.gz
slixmpp-f81fb6af4403cacddf81081cee2273b657a8aae5.tar.bz2
slixmpp-f81fb6af4403cacddf81081cee2273b657a8aae5.tar.xz
slixmpp-f81fb6af4403cacddf81081cee2273b657a8aae5.zip
Require explicitly setting access_token value.
Silently substituting the password field was nice, but for mechs that can use either the password or an access token, it makes things very difficult. This really only affects MSN clients since Facebook clients should already be setting the api key.
Diffstat (limited to 'sleekxmpp/features/feature_mechanisms/mechanisms.py')
-rw-r--r--sleekxmpp/features/feature_mechanisms/mechanisms.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/sleekxmpp/features/feature_mechanisms/mechanisms.py b/sleekxmpp/features/feature_mechanisms/mechanisms.py
index 48a5de1c..5df1ea63 100644
--- a/sleekxmpp/features/feature_mechanisms/mechanisms.py
+++ b/sleekxmpp/features/feature_mechanisms/mechanisms.py
@@ -36,18 +36,17 @@ class feature_mechanisms(base_plugin):
return 'starttls' in self.xmpp.features
def basic_callback(mech, values):
+ creds = self.xmpp.credentials
for value in values:
if value == 'username':
values['username'] = self.xmpp.boundjid.user
elif value == 'password':
- values['password'] = self.xmpp.credentials['password']
- elif value == 'access_token':
- if 'access_token' in self.xmpp.credentials:
- values['access_token'] = self.xmpp.credentials['access_token']
- else:
- values['access_token'] = self.xmpp.credentials['password']
- elif value in self.xmpp.credentials:
- values[value] = self.xmpp.credentials[value]
+ values['password'] = creds['password']
+ elif value == 'email':
+ jid = self.xmpp.boundjid.bare
+ values['email'] = creds.get('email', jid)
+ elif value in creds:
+ values[value] = creds[value]
mech.fulfill(values)
sasl_callback = self.config.get('sasl_callback', None)