E2E dialogs

* String changes
* Improve SAS visibility
* Add ability to re-verify
* espace text and buttons
* Should fix #3468
This commit is contained in:
Julien Pivotto 2008-08-28 13:14:54 +00:00
parent 64cc3f907e
commit 1c2ce732b1
3 changed files with 21 additions and 8 deletions

View File

@ -31,7 +31,7 @@
<widget class="GtkHBox" id="hbox4">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<property name="spacing">4</property>
<child>
<widget class="GtkVBox" id="vbox2">
@ -145,7 +145,7 @@
</child>
<child>
<widget class="GtkLabel" id="label4">
<widget class="GtkLabel" id="button_label">
<property name="visible">True</property>
<property name="label" translatable="yes">_Verify</property>
<property name="use_underline">True</property>

View File

@ -915,6 +915,9 @@ class EncryptedStanzaSession(StanzaSession):
def _verified_srs_cb(self):
secrets.secrets().replace_srs(self.conn.name, self.jid.getStripped(), self.srs, self.srs, True)
def _unverified_srs_cb(self):
secrets.secrets().replace_srs(self.conn.name, self.jid.getStripped(), self.srs, self.srs, False)
def make_dhfield(self, modp_options, sigmai):
dhs = []

View File

@ -3811,6 +3811,7 @@ class ESessionInfoWindow:
self.security_image = self.xml.get_widget('security_image')
self.verify_now_button = self.xml.get_widget('verify_now_button')
self.button_label = self.xml.get_widget('button_label')
self.window = self.xml.get_widget('esession_info_window')
self.update_info()
@ -3818,7 +3819,7 @@ class ESessionInfoWindow:
self.window.show_all()
def update_info(self):
labeltext = _('''Your chat session with %(jid)s is encrypted.\n\nThis session's Short Authentication String is %(sas)s.''') % {'jid': self.session.jid, 'sas': self.session.sas}
labeltext = _('''Your chat session with %(jid)s is encrypted.\n\nThis session's Short Authentication String is <b>%(sas)s</b>.''') % {'jid': self.session.jid, 'sas': self.session.sas}
dir = os.path.join(gajim.DATA_DIR, 'pixmaps')
if self.session.verified_identity:
@ -3829,23 +3830,27 @@ class ESessionInfoWindow:
self.session.is_loggable(), True)
self.window.set_title(_('''Contact's identity verified'''))
self.xml.get_widget('dialog-action_area1').set_no_show_all(True)
self.verify_now_button.hide()
self.button_label.set_text(_('Verify again'))
else:
labeltext += '\n\n' + _('''To be certain that only the expected person can read your messages or send you messages, you need to verify their identity.''')
if self.session.control:
self.session.control._show_lock_image(True, 'E2E', True,
self.session.is_loggable(), False)
labeltext += '\n\n' + _('''To be certain that <b>only</b> the expected person can read your messages or send you messages, you need to verify their identity by clicking the button above.''')
security_image = 'security-low-big.png'
self.window.set_title(_('''Contact's identity NOT verified'''))
self.button_label.set_text(_('Verify'))
path = os.path.join(dir, security_image)
filename = os.path.abspath(path)
self.security_image.set_from_file(filename)
self.xml.get_widget('info_display').set_text(labeltext)
self.xml.get_widget('info_display').set_markup(labeltext)
def on_close_button_clicked(self, widget):
self.window.destroy()
def on_verify_now_button_clicked(self, widget):
pritext = _('''Have you verified the remote contact's identity?''')
pritext = _('''Have you verified the contact's identity?''')
sectext = _('''To prevent a man-in-the-middle attack, you should speak to %(jid)s directly (in person or on the phone) and verify that they see the same Short Authentication String (SAS) as you.\n\nThis session's Short Authentication String is <b>%(sas)s</b>.''') % {'jid': self.session.jid, 'sas': self.session.sas}
sectext += '\n\n' + _('Did you talk to the remote contact and verify the SAS?')
@ -3854,6 +3859,11 @@ class ESessionInfoWindow:
self.session.verified_identity = True
self.update_info()
YesNoDialog(pritext, sectext, on_response_yes=on_yes)
def on_no():
self.session._unverified_srs_cb()
self.session.verified_identity = False
self.update_info()
YesNoDialog(pritext, sectext, on_response_yes=on_yes, on_response_no=on_no)
# vim: se ts=3: