comparison src/stdui/ui_profile_manager.py @ 1089:8e0072754413

core, plugins, stdui, frontends: fixes handling of "Force server" and "Force port" parameters: - do not save a "guessed" value, they must stay empty until the user explicitely sets them - add constant XMPP_C2S_PORT (default value 5222)
author souliane <souliane@mailoo.org>
date Mon, 23 Jun 2014 10:23:13 +0200
parents b29452cab50b
children 90f82f4ee405
comparison
equal deleted inserted replaced
1088:b29452cab50b 1089:8e0072754413
22 from sat.core.constants import Const as C 22 from sat.core.constants import Const as C
23 from sat.tools import xml_tools 23 from sat.tools import xml_tools
24 from sat.memory.crypto import PasswordHasher 24 from sat.memory.crypto import PasswordHasher
25 from sat.memory.memory import ProfileSessions 25 from sat.memory.memory import ProfileSessions
26 from twisted.internet import defer 26 from twisted.internet import defer
27 from twisted.words.protocols.jabber import jid
27 28
28 29
29 class ProfileManager(object): 30 class ProfileManager(object):
30 """Manage profiles.""" 31 """Manage profiles."""
31 32
109 110
110 def _changeXMPPPassword(self, data, profile): 111 def _changeXMPPPassword(self, data, profile):
111 session_data = self._sessions.profileGetUnique(profile) 112 session_data = self._sessions.profileGetUnique(profile)
112 if not session_data: 113 if not session_data:
113 server = self.host.memory.getParamA(C.FORCE_SERVER_PARAM, "Connection", profile_key=profile) 114 server = self.host.memory.getParamA(C.FORCE_SERVER_PARAM, "Connection", profile_key=profile)
115 if not server:
116 server = jid.parse(self.host.memory.getParamA('JabberID', "Connection", profile_key=profile))[1]
114 session_id, session_data = self._sessions.newSession({'count': 0, 'server': server}, profile) 117 session_id, session_data = self._sessions.newSession({'count': 0, 'server': server}, profile)
115 if session_data['count'] > 2: # 3 attempts with a new password after the initial try 118 if session_data['count'] > 2: # 3 attempts with a new password after the initial try
116 self._sessions.profileDelUnique(profile) 119 self._sessions.profileDelUnique(profile)
117 _dialog = xml_tools.XMLUI('popup', title=D_('Connection error')) 120 _dialog = xml_tools.XMLUI('popup', title=D_('Connection error'))
118 _dialog.addText(D_("Can't connect to %s. Please check your connection details.") % session_data['server']) 121 _dialog.addText(D_("Can't connect to %s. Please check your connection details.") % session_data['server'])