annotate src/plugins/plugin_misc_register_account.py @ 1054:a32ef03d4af0

installation: added python OTR dependency
author Goffi <goffi@goffi.org>
date Sat, 07 Jun 2014 16:39:08 +0200
parents 85c110c0be86
children b29452cab50b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1037
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
1 #!/usr/bin/python
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
3
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
4 # SàT plugin for registering a new XMPP account
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
5 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Jérôme Poisson (goffi@goffi.org)
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
6 # Copyright (C) 2013, 2014 Adrien Cossa (souliane@mailoo.org)
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
7
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
8 # This program is free software: you can redistribute it and/or modify
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
9 # it under the terms of the GNU Affero General Public License as published by
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
10 # the Free Software Foundation, either version 3 of the License, or
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
11 # (at your option) any later version.
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
12
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
13 # This program is distributed in the hope that it will be useful,
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
16 # GNU Affero General Public License for more details.
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
17
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
18 # You should have received a copy of the GNU Affero General Public License
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
20
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
21 from sat.core.i18n import _, D_
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
22 from sat.core.log import getLogger
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
23 log = getLogger(__name__)
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
24 from sat.core.constants import Const as C
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
25 from twisted.words.protocols.jabber import jid, xmlstream
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
26 from sat.core import xmpp
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
27 from sat.memory.memory import Sessions
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
28 from twisted.internet import reactor, defer
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
29 from sat.tools import xml_tools
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
30 from sat.tools.xml_tools import SAT_FORM_PREFIX, SAT_PARAM_SEPARATOR
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
31
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
32
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
33 PLUGIN_INFO = {
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
34 "name": "Register Account Plugin",
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
35 "import_name": "REGISTER-ACCOUNT",
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
36 "type": "MISC",
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
37 "protocols": [],
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
38 "dependencies": [],
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
39 "recommendations": [],
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
40 "main": "RegisterAccount",
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
41 "handler": "no",
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
42 "description": _(u"""Register XMPP account""")
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
43 }
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
44
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
45
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
46 class RegisterAccount(object):
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
47
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
48 def __init__(self, host):
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
49 log.info(_(u"Plugin Register Account initialization"))
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
50 self.host = host
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
51 self._sessions = Sessions()
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
52 host.registerCallback(self.registerNewAccountCB, with_data=True, force_id="registerNewAccount")
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
53 self.__register_account_id = host.registerCallback(self._registerConfirmation, with_data=True)
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
54
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
55 def registerNewAccountCB(self, data, profile):
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
56 """Called when the use click on the "New account" button."""
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
57 session_data = {}
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
58 for param in ('JabberID', 'Password', 'Port', 'Server'):
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
59 try:
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
60 session_data[param] = data["%s%s%s%s" % (SAT_FORM_PREFIX, "Connection", SAT_PARAM_SEPARATOR, param)]
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
61 except KeyError:
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
62 if param == 'Port':
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
63 session_data[param] = 5222
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
64
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
65 for param in ('JabberID', 'Password', 'Server'):
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
66 if not session_data[param]:
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
67 form_ui = xml_tools.XMLUI("popup", title=D_("Missing values"))
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
68 form_ui.addText(D_("No user, password or server given: can't register new account."))
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
69 return {'xmlui': form_ui.toXml()}
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
70
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
71 user = jid.parse(session_data['JabberID'])[0]
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
72 session_id, dummy = self._sessions.newSession(session_data, profile)
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
73 form_ui = xml_tools.XMLUI("form", title=D_("Register new account"), submit_id=self.__register_account_id, session_id=session_id)
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
74 form_ui.addText(D_("Do you want to register a new XMPP account [%(user)s] on server %(server)s ?") % {'user': user, 'server': session_data['Server']})
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
75 return {'xmlui': form_ui.toXml()}
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
76
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
77 def _registerConfirmation(self, data, profile):
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
78 """Save the related parameters and proceed the registration."""
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
79 session_data = self._sessions.profileGet(data['session_id'], profile)
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
80
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
81 self.host.memory.setParam("JabberID", session_data["JabberID"], "Connection", profile_key=profile)
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
82 self.host.memory.setParam("Password", session_data["Password"], "Connection", profile_key=profile)
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
83 self.host.memory.setParam("Server", session_data["Server"], "Connection", profile_key=profile)
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
84 self.host.memory.setParam("Port", session_data["Port"], "Connection", profile_key=profile)
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
85
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
86 user = jid.parse(session_data['JabberID'])[0]
1044
85c110c0be86 plugins misc_account, misc_register_account: manually delete the sessions when not needed anymore
souliane <souliane@mailoo.org>
parents: 1037
diff changeset
87 d = self._registerNewAccount(user, session_data["Password"], None, session_data["Server"], profile_key=profile)
85c110c0be86 plugins misc_account, misc_register_account: manually delete the sessions when not needed anymore
souliane <souliane@mailoo.org>
parents: 1037
diff changeset
88 del self._sessions[data['session_id']]
85c110c0be86 plugins misc_account, misc_register_account: manually delete the sessions when not needed anymore
souliane <souliane@mailoo.org>
parents: 1037
diff changeset
89 return d
1037
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
90
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
91 def _registerNewAccount(self, user, password, email, host, port=5222, profile_key=C.PROF_KEY_NONE):
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
92 """Connect to a server and create a new account using in-band registration.
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
93 @param user: login of the account
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
94 @param password: password of the account
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
95 @param email: email of the account
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
96 @param host: host of the server to register to
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
97 @param port: port of the server to register to
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
98 @param profile_key: %(doc_profile_key)s
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
99 """
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
100 profile = self.host.memory.getProfileName(profile_key)
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
101
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
102 d = defer.Deferred()
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
103 serverRegistrer = xmlstream.XmlStreamFactory(xmpp.RegisteringAuthenticator(self, host, user, password, email, d, profile))
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
104 connector = reactor.connectTCP(host, port, serverRegistrer)
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
105 serverRegistrer.clientConnectionLost = lambda conn, reason: connector.disconnect()
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
106
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
107 def cb(dummy):
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
108 xmlui = xml_tools.XMLUI("popup", title=D_("Confirmation"))
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
109 xmlui.addText(D_("Registration successful."))
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
110 return ({'xmlui': xmlui.toXml()})
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
111
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
112 def eb(failure):
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
113 xmlui = xml_tools.XMLUI("popup", title=D_("Failure"))
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
114 xmlui.addText(D_("Registration failed: %s") % failure.getErrorMessage())
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
115 try:
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
116 if failure.value.condition == 'conflict':
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
117 xmlui.addText(D_("Username already exists, please choose an other one."))
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
118 except AttributeError:
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
119 pass
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
120 return ({'xmlui': xmlui.toXml()})
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
121
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
122 d.addCallbacks(cb, eb)
6e975c6b0faf core, memory, bridge, plugin misc_register_account: move registerNewAccount to a new plugin:
souliane <souliane@mailoo.org>
parents:
diff changeset
123 return d