change the insecure connection dialog behaviour. Fixes #7019
This commit is contained in:
parent
493187d448
commit
520bc6b268
|
@ -323,7 +323,7 @@ class Config:
|
||||||
'enable_esessions': [opt_bool, True, _('Enable ESessions encryption for this account.')],
|
'enable_esessions': [opt_bool, True, _('Enable ESessions encryption for this account.')],
|
||||||
'autonegotiate_esessions': [opt_bool, True, _('Should Gajim automatically start an encrypted session when possible?')],
|
'autonegotiate_esessions': [opt_bool, True, _('Should Gajim automatically start an encrypted session when possible?')],
|
||||||
'connection_types': [ opt_str, 'tls ssl plain', _('Ordered list (space separated) of connection type to try. Can contain tls, ssl or plain')],
|
'connection_types': [ opt_str, 'tls ssl plain', _('Ordered list (space separated) of connection type to try. Can contain tls, ssl or plain')],
|
||||||
'warn_when_plaintext_connection': [ opt_bool, True, _('Show a warning dialog before sending password on an plaintext connection.') ],
|
'action_when_plaintext_connection': [ opt_str, 'warn', _('Show a warning dialog before sending password on an plaintext connection. Can be \'warn\', \'connect\', \'disconnect\'') ],
|
||||||
'warn_when_insecure_ssl_connection': [ opt_bool, True, _('Show a warning dialog before using standard SSL library.') ],
|
'warn_when_insecure_ssl_connection': [ opt_bool, True, _('Show a warning dialog before using standard SSL library.') ],
|
||||||
'warn_when_insecure_password': [ opt_bool, True, _('Show a warning dialog before sending PLAIN password over a plain connection.') ],
|
'warn_when_insecure_password': [ opt_bool, True, _('Show a warning dialog before sending PLAIN password over a plain connection.') ],
|
||||||
'ssl_fingerprint_sha1': [ opt_str, '', '', True ],
|
'ssl_fingerprint_sha1': [ opt_str, '', '', True ],
|
||||||
|
|
|
@ -1254,10 +1254,16 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
return
|
return
|
||||||
con.RegisterDisconnectHandler(self._on_disconnected)
|
con.RegisterDisconnectHandler(self._on_disconnected)
|
||||||
if _con_type == 'plain' and gajim.config.get_per('accounts', self.name,
|
if _con_type == 'plain' and gajim.config.get_per('accounts', self.name,
|
||||||
'warn_when_plaintext_connection'):
|
'action_when_plaintext_connection') == 'warn':
|
||||||
gajim.nec.push_incoming_event(PlainConnectionEvent(None, conn=self,
|
gajim.nec.push_incoming_event(PlainConnectionEvent(None, conn=self,
|
||||||
xmpp_client=con))
|
xmpp_client=con))
|
||||||
return True
|
return True
|
||||||
|
if _con_type == 'plain' and gajim.config.get_per('accounts', self.name,
|
||||||
|
'action_when_plaintext_connection') == 'disconnect':
|
||||||
|
self.disconnect(on_purpose=True)
|
||||||
|
gajim.nec.push_incoming_event(OurShowEvent(None, conn=self,
|
||||||
|
show='offline'))
|
||||||
|
return False
|
||||||
if _con_type in ('tls', 'ssl') and con.Connection.ssl_lib != 'PYOPENSSL' \
|
if _con_type in ('tls', 'ssl') and con.Connection.ssl_lib != 'PYOPENSSL' \
|
||||||
and gajim.config.get_per('accounts', self.name,
|
and gajim.config.get_per('accounts', self.name,
|
||||||
'warn_when_insecure_ssl_connection') and \
|
'warn_when_insecure_ssl_connection') and \
|
||||||
|
|
|
@ -1722,7 +1722,8 @@ class ConfirmationDialogDoubleCheck(ConfirmationDialog):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, pritext, sectext='', checktext1='', checktext2='',
|
def __init__(self, pritext, sectext='', checktext1='', checktext2='',
|
||||||
on_response_ok=None, on_response_cancel=None, is_modal=True):
|
tooltip1='', tooltip2='', on_response_ok=None, on_response_cancel=None,
|
||||||
|
is_modal=True):
|
||||||
self.user_response_ok = on_response_ok
|
self.user_response_ok = on_response_ok
|
||||||
self.user_response_cancel = on_response_cancel
|
self.user_response_cancel = on_response_cancel
|
||||||
|
|
||||||
|
@ -1741,11 +1742,15 @@ class ConfirmationDialogDoubleCheck(ConfirmationDialog):
|
||||||
|
|
||||||
if checktext1:
|
if checktext1:
|
||||||
self.checkbutton1 = gtk.CheckButton(checktext1)
|
self.checkbutton1 = gtk.CheckButton(checktext1)
|
||||||
|
if tooltip1:
|
||||||
|
self.checkbutton1.set_tooltip_text(tooltip1)
|
||||||
self.vbox.pack_start(self.checkbutton1, expand=False, fill=True)
|
self.vbox.pack_start(self.checkbutton1, expand=False, fill=True)
|
||||||
else:
|
else:
|
||||||
self.checkbutton1 = None
|
self.checkbutton1 = None
|
||||||
if checktext2:
|
if checktext2:
|
||||||
self.checkbutton2 = gtk.CheckButton(checktext2)
|
self.checkbutton2 = gtk.CheckButton(checktext2)
|
||||||
|
if tooltip2:
|
||||||
|
self.checkbutton2.set_tooltip_text(tooltip2)
|
||||||
self.vbox.pack_start(self.checkbutton2, expand=False, fill=True)
|
self.vbox.pack_start(self.checkbutton2, expand=False, fill=True)
|
||||||
else:
|
else:
|
||||||
self.checkbutton2 = None
|
self.checkbutton2 = None
|
||||||
|
|
|
@ -1249,6 +1249,9 @@ class Interface:
|
||||||
# ('PLAIN_CONNECTION', account, (connection))
|
# ('PLAIN_CONNECTION', account, (connection))
|
||||||
def on_ok(is_checked):
|
def on_ok(is_checked):
|
||||||
if not is_checked[0]:
|
if not is_checked[0]:
|
||||||
|
if is_checked[1]:
|
||||||
|
gajim.config.set_per('accounts', obj.conn.name,
|
||||||
|
'action_when_plaintext_connection', 'disconnect')
|
||||||
on_cancel()
|
on_cancel()
|
||||||
return
|
return
|
||||||
# On cancel call del self.instances, so don't call it another time
|
# On cancel call del self.instances, so don't call it another time
|
||||||
|
@ -1257,7 +1260,7 @@ class Interface:
|
||||||
['plain_connection']
|
['plain_connection']
|
||||||
if is_checked[1]:
|
if is_checked[1]:
|
||||||
gajim.config.set_per('accounts', obj.conn.name,
|
gajim.config.set_per('accounts', obj.conn.name,
|
||||||
'warn_when_plaintext_connection', False)
|
'action_when_plaintext_connection', 'connect')
|
||||||
obj.conn.connection_accepted(obj.xmpp_client, 'plain')
|
obj.conn.connection_accepted(obj.xmpp_client, 'plain')
|
||||||
|
|
||||||
def on_cancel():
|
def on_cancel():
|
||||||
|
@ -1270,18 +1273,20 @@ class Interface:
|
||||||
pritext = _('Insecure connection')
|
pritext = _('Insecure connection')
|
||||||
sectext = _('You are about to connect to the account %(account)s '
|
sectext = _('You are about to connect to the account %(account)s '
|
||||||
'(%(server)s) with an insecure connection. This means all your '
|
'(%(server)s) with an insecure connection. This means all your '
|
||||||
'conversations will be exchanged unencrypted. Are you sure you '
|
'conversations will be exchanged unencrypted. This type of '
|
||||||
'want to do that?') % {'account': obj.conn.name,
|
'connection is really discouraged.\nAre you sure you want to do '
|
||||||
|
'that?') % {'account': obj.conn.name,
|
||||||
'server': gajim.get_hostname_from_account(obj.conn.name)}
|
'server': gajim.get_hostname_from_account(obj.conn.name)}
|
||||||
checktext1 = _('Yes, I really want to connect insecurely')
|
checktext1 = _('Yes, I really want to connect insecurely')
|
||||||
|
tooltip1 = _('Gajim will NOT connect unless you check this box')
|
||||||
checktext2 = _('_Do not ask me again')
|
checktext2 = _('_Do not ask me again')
|
||||||
if 'plain_connection' in self.instances[obj.conn.name]['online_dialog']:
|
if 'plain_connection' in self.instances[obj.conn.name]['online_dialog']:
|
||||||
self.instances[obj.conn.name]['online_dialog']['plain_connection'].\
|
self.instances[obj.conn.name]['online_dialog']['plain_connection'].\
|
||||||
destroy()
|
destroy()
|
||||||
self.instances[obj.conn.name]['online_dialog']['plain_connection'] = \
|
self.instances[obj.conn.name]['online_dialog']['plain_connection'] = \
|
||||||
dialogs.ConfirmationDialogDoubleCheck(pritext, sectext, checktext1,
|
dialogs.ConfirmationDialogDoubleCheck(pritext, sectext, checktext1,
|
||||||
checktext2, on_response_ok=on_ok, on_response_cancel=on_cancel,
|
checktext2, tooltip1=tooltip1, on_response_ok=on_ok,
|
||||||
is_modal=False)
|
on_response_cancel=on_cancel, is_modal=False)
|
||||||
|
|
||||||
def handle_event_insecure_ssl_connection(self, obj):
|
def handle_event_insecure_ssl_connection(self, obj):
|
||||||
# ('INSECURE_SSL_CONNECTION', account, (connection, connection_type))
|
# ('INSECURE_SSL_CONNECTION', account, (connection, connection_type))
|
||||||
|
|
Loading…
Reference in New Issue