backport anti-phishing measures to 3.2
This commit is contained in:
@@ -887,8 +887,11 @@ class ElectrumWindow(App):
|
||||
self.wallet.invoices.save()
|
||||
self.update_tab('invoices')
|
||||
else:
|
||||
msg = msg[:500] if msg else _('There was an error broadcasting the transaction.')
|
||||
self.show_error(msg)
|
||||
display_msg = _('The server returned an error when broadcasting the transaction.')
|
||||
if msg:
|
||||
display_msg += '\n' + msg
|
||||
display_msg = display_msg[:500]
|
||||
self.show_error(display_msg)
|
||||
|
||||
if self.network and self.network.is_connected():
|
||||
self.show_info(_('Sending'))
|
||||
|
||||
@@ -579,7 +579,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||
_("Before reporting a bug, upgrade to the most recent version of Electrum (latest release or git HEAD), and include the version number in your report."),
|
||||
_("Try to explain not only what the bug is, but how it occurs.")
|
||||
])
|
||||
self.show_message(msg, title="Electrum - " + _("Reporting Bugs"))
|
||||
self.show_message(msg, title="Electrum - " + _("Reporting Bugs"), rich_text=True)
|
||||
|
||||
def notify_transactions(self):
|
||||
if not self.network or not self.network.is_connected():
|
||||
@@ -1636,7 +1636,10 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||
self.invoice_list.update()
|
||||
self.do_clear()
|
||||
else:
|
||||
parent.show_error(msg)
|
||||
display_msg = _('The server returned an error when broadcasting the transaction.')
|
||||
if msg:
|
||||
display_msg += '\n' + msg
|
||||
parent.show_error(display_msg)
|
||||
|
||||
WaitingDialog(self, _('Broadcasting transaction...'),
|
||||
broadcast_thread, broadcast_done, self.on_error)
|
||||
|
||||
@@ -200,24 +200,24 @@ class MessageBoxMixin(object):
|
||||
parent, title or '',
|
||||
msg, buttons=Yes|No, defaultButton=No) == Yes
|
||||
|
||||
def show_warning(self, msg, parent=None, title=None):
|
||||
def show_warning(self, msg, parent=None, title=None, **kwargs):
|
||||
return self.msg_box(QMessageBox.Warning, parent,
|
||||
title or _('Warning'), msg)
|
||||
title or _('Warning'), msg, **kwargs)
|
||||
|
||||
def show_error(self, msg, parent=None):
|
||||
def show_error(self, msg, parent=None, **kwargs):
|
||||
return self.msg_box(QMessageBox.Warning, parent,
|
||||
_('Error'), msg)
|
||||
_('Error'), msg, **kwargs)
|
||||
|
||||
def show_critical(self, msg, parent=None, title=None):
|
||||
def show_critical(self, msg, parent=None, title=None, **kwargs):
|
||||
return self.msg_box(QMessageBox.Critical, parent,
|
||||
title or _('Critical Error'), msg)
|
||||
title or _('Critical Error'), msg, **kwargs)
|
||||
|
||||
def show_message(self, msg, parent=None, title=None):
|
||||
def show_message(self, msg, parent=None, title=None, **kwargs):
|
||||
return self.msg_box(QMessageBox.Information, parent,
|
||||
title or _('Information'), msg)
|
||||
title or _('Information'), msg, **kwargs)
|
||||
|
||||
def msg_box(self, icon, parent, title, text, buttons=QMessageBox.Ok,
|
||||
defaultButton=QMessageBox.NoButton):
|
||||
defaultButton=QMessageBox.NoButton, rich_text=False):
|
||||
parent = parent or self.top_level_window()
|
||||
if type(icon) is QPixmap:
|
||||
d = QMessageBox(QMessageBox.Information, title, str(text), buttons, parent)
|
||||
@@ -226,7 +226,12 @@ class MessageBoxMixin(object):
|
||||
d = QMessageBox(icon, title, str(text), buttons, parent)
|
||||
d.setWindowModality(Qt.WindowModal)
|
||||
d.setDefaultButton(defaultButton)
|
||||
d.setTextInteractionFlags(Qt.TextSelectableByMouse)
|
||||
if rich_text:
|
||||
d.setTextInteractionFlags(Qt.TextSelectableByMouse| Qt.LinksAccessibleByMouse)
|
||||
d.setTextFormat(Qt.RichText)
|
||||
else:
|
||||
d.setTextInteractionFlags(Qt.TextSelectableByMouse)
|
||||
d.setTextFormat(Qt.PlainText)
|
||||
return d.exec_()
|
||||
|
||||
class WindowModalDialog(QDialog, MessageBoxMixin):
|
||||
|
||||
@@ -207,7 +207,9 @@ class ElectrumGui:
|
||||
#self.do_clear()
|
||||
#self.update_contacts_tab()
|
||||
else:
|
||||
print(_('Error'))
|
||||
display_msg = _('The server returned an error when broadcasting the transaction.')
|
||||
display_msg += '\n' + repr(e)
|
||||
print(display_msg)
|
||||
|
||||
def network_dialog(self):
|
||||
print("use 'electrum setconfig server/proxy' to change your network settings")
|
||||
|
||||
@@ -358,8 +358,9 @@ class ElectrumGui:
|
||||
self.do_clear()
|
||||
#self.update_contacts_tab()
|
||||
else:
|
||||
self.show_message(_('Error'))
|
||||
|
||||
display_msg = _('The server returned an error when broadcasting the transaction.')
|
||||
display_msg += '\n' + repr(e)
|
||||
self.show_message(display_msg)
|
||||
|
||||
def show_message(self, message, getchar = True):
|
||||
w = self.w
|
||||
|
||||
@@ -158,7 +158,7 @@ class Plugin(BasePlugin):
|
||||
else:
|
||||
|
||||
if (len(txt)>0 and txt[0]=='0'):
|
||||
self.d.show_message(''.join(["<b>",_("Warning: "), "</b>", _("Revealers starting with 0 had a vulnerability and are not supported.")]))
|
||||
self.d.show_message(''.join(["<b>",_("Warning: "), "</b>", _("Revealers starting with 0 had a vulnerability and are not supported.")]), rich_text=True)
|
||||
self.user_input = False
|
||||
return False
|
||||
|
||||
@@ -170,16 +170,16 @@ class Plugin(BasePlugin):
|
||||
def bcrypt(self, dialog):
|
||||
self.rawnoise = False
|
||||
dialog.show_message(''.join([_("{} encrypted for Revealer {}_{} saved as PNG and PDF at:").format(self.was, self.version, self.code_id),
|
||||
"<br/>","<b>", self.base_dir+ self.filename+self.version+"_"+self.code_id,"</b>"]))
|
||||
"<br/>","<b>", self.base_dir+ self.filename+self.version+"_"+self.code_id,"</b>"]), rich_text=True)
|
||||
dialog.close()
|
||||
|
||||
def ext_warning(self, dialog):
|
||||
dialog.show_message(''.join(["<b>",_("Warning: "), "</b>", _("your seed extension will not be included in the encrypted backup.")]))
|
||||
dialog.show_message(''.join(["<b>",_("Warning: "), "</b>", _("your seed extension will not be included in the encrypted backup.")]), rich_text=True)
|
||||
dialog.close()
|
||||
|
||||
def bdone(self, dialog):
|
||||
dialog.show_message(''.join([_("Digital Revealer ({}_{}) saved as PNG and PDF at:").format(self.version, self.code_id),
|
||||
"<br/>","<b>", self.base_dir + 'revealer_' +self.version + '_'+ self.code_id, '</b>']))
|
||||
"<br/>","<b>", self.base_dir + 'revealer_' +self.version + '_'+ self.code_id, '</b>']), rich_text=True)
|
||||
|
||||
|
||||
def customtxt_limits(self):
|
||||
|
||||
Reference in New Issue
Block a user