add some test when we create / modify an account (a valid JID can have no nickname according to the RFC, but an account MUST have one)
This commit is contained in:
parent
2b0d8e2a70
commit
6d7ec70dd1
|
@ -1174,16 +1174,23 @@ class AccountModificationWindow:
|
||||||
try:
|
try:
|
||||||
jid = helpers.parse_jid(jid)
|
jid = helpers.parse_jid(jid)
|
||||||
except helpers.InvalidFormat, s:
|
except helpers.InvalidFormat, s:
|
||||||
pritext = _('Invalid User ID')
|
pritext = _('Invalid Jabber ID')
|
||||||
dialogs.ErrorDialog(pritext, s).get_response()
|
dialogs.ErrorDialog(pritext, str(s)).get_response()
|
||||||
|
return
|
||||||
|
|
||||||
|
n, hn = jid.split('@', 1)
|
||||||
|
if not n:
|
||||||
|
pritext = _('Invalid Jabber ID')
|
||||||
|
sectext = _('A Jabber ID must be in the form "user@servername".')
|
||||||
|
dialogs.ErrorDialog(pritext, sectext).get_response()
|
||||||
return
|
return
|
||||||
|
|
||||||
resource = self.xml.get_widget('resource_entry').get_text().decode('utf-8')
|
resource = self.xml.get_widget('resource_entry').get_text().decode('utf-8')
|
||||||
try:
|
try:
|
||||||
resource = helpers.parse_resource(resource)
|
resource = helpers.parse_resource(resource)
|
||||||
except helpers.InvalidFormat, s:
|
except helpers.InvalidFormat, s:
|
||||||
pritext = _('Invalid User ID')
|
pritext = _('Invalid Jabber ID')
|
||||||
dialogs.ErrorDialog(pritext, s).get_response()
|
dialogs.ErrorDialog(pritext, (s)).get_response()
|
||||||
return
|
return
|
||||||
|
|
||||||
config['savepass'] = self.xml.get_widget(
|
config['savepass'] = self.xml.get_widget(
|
||||||
|
@ -1219,7 +1226,6 @@ class AccountModificationWindow:
|
||||||
config['proxy'] = proxy
|
config['proxy'] = proxy
|
||||||
|
|
||||||
config['usessl'] = self.xml.get_widget('use_ssl_checkbutton').get_active()
|
config['usessl'] = self.xml.get_widget('use_ssl_checkbutton').get_active()
|
||||||
n, hn = jid.split('@')
|
|
||||||
config['name'] = n
|
config['name'] = n
|
||||||
config['hostname'] = hn
|
config['hostname'] = hn
|
||||||
|
|
||||||
|
@ -2509,16 +2515,26 @@ class AccountCreationWizardWindow:
|
||||||
|
|
||||||
widgets = self.get_widgets()
|
widgets = self.get_widgets()
|
||||||
username = widgets['nick_entry'].get_text().decode('utf-8')
|
username = widgets['nick_entry'].get_text().decode('utf-8')
|
||||||
|
if not username:
|
||||||
|
pritext = _('Invalid nickname')
|
||||||
|
sectext = _('You must provide a nickname to configure this account.')
|
||||||
|
dialogs.ErrorDialog(pritext, sectext).get_response()
|
||||||
|
return
|
||||||
server = widgets['server_comboboxentry'].child.get_text()
|
server = widgets['server_comboboxentry'].child.get_text()
|
||||||
savepass = widgets['save_password_checkbutton'].get_active()
|
savepass = widgets['save_password_checkbutton'].get_active()
|
||||||
password = widgets['pass_entry'].get_text()
|
password = widgets['pass_entry'].get_text()
|
||||||
|
|
||||||
|
if not self.modify and password == '':
|
||||||
|
dialogs.ErrorDialog(_('Invalid password'),
|
||||||
|
_('You must enter a password for the new account.')).get_response()
|
||||||
|
return
|
||||||
|
|
||||||
jid = username + '@' + server
|
jid = username + '@' + server
|
||||||
# check if jid is conform to RFC and stringprep it
|
# check if jid is conform to RFC and stringprep it
|
||||||
try:
|
try:
|
||||||
jid = helpers.parse_jid(jid)
|
jid = helpers.parse_jid(jid)
|
||||||
except helpers.InvalidFormat, s:
|
except helpers.InvalidFormat, s:
|
||||||
pritext = _('Invalid User ID')
|
pritext = _('Invalid Jabber ID')
|
||||||
dialogs.ErrorDialog(pritext, str(s)).get_response()
|
dialogs.ErrorDialog(pritext, str(s)).get_response()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -2581,10 +2597,6 @@ class AccountCreationWizardWindow:
|
||||||
jid_label.set_label(string)
|
jid_label.set_label(string)
|
||||||
|
|
||||||
def save_account(self, name, login, server, savepass, password):
|
def save_account(self, name, login, server, savepass, password):
|
||||||
if not self.modify and password == '':
|
|
||||||
dialogs.ErrorDialog(_('Invalid password'),
|
|
||||||
_('You must enter a password for the new account.')).get_response()
|
|
||||||
return
|
|
||||||
config = {}
|
config = {}
|
||||||
config['name'] = login
|
config['name'] = login
|
||||||
config['hostname'] = server
|
config['hostname'] = server
|
||||||
|
|
|
@ -14321,7 +14321,7 @@ to the Jabber network.</property>
|
||||||
<widget class="GtkCheckButton" id="go_online_checkbutton">
|
<widget class="GtkCheckButton" id="go_online_checkbutton">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="label" translatable="yes">Go Online when I press Finish</property>
|
<property name="label" translatable="yes">Connect when I press Finish</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
<property name="focus_on_click">True</property>
|
<property name="focus_on_click">True</property>
|
||||||
|
|
Loading…
Reference in New Issue