when wrong GPG passphrase is entered, we re-ask to user twice. Fixes [1410]
This commit is contained in:
parent
97378c63ed
commit
89bf45a2c6
|
@ -1916,6 +1916,13 @@ class Connection:
|
||||||
#Inform GUI we just signed in
|
#Inform GUI we just signed in
|
||||||
self.dispatch('SIGNED_IN', ())
|
self.dispatch('SIGNED_IN', ())
|
||||||
|
|
||||||
|
def test_gpg_passphrase(self, password):
|
||||||
|
self.gpg.passphrase = password
|
||||||
|
keyID = gajim.config.get_per('accounts', self.name, 'keyid')
|
||||||
|
signed = self.gpg.sign('test', keyID)
|
||||||
|
self.gpg.password = None
|
||||||
|
return signed != 'BAD_PASSPHRASE'
|
||||||
|
|
||||||
def get_signed_msg(self, msg):
|
def get_signed_msg(self, msg):
|
||||||
signed = ''
|
signed = ''
|
||||||
keyID = gajim.config.get_per('accounts', self.name, 'keyid')
|
keyID = gajim.config.get_per('accounts', self.name, 'keyid')
|
||||||
|
|
|
@ -1518,14 +1518,25 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
|
||||||
passphrase = self.gpg_passphrase[keyid]
|
passphrase = self.gpg_passphrase[keyid]
|
||||||
save = False
|
save = False
|
||||||
else:
|
else:
|
||||||
w = dialogs.PassphraseDialog(
|
password_ok = False
|
||||||
_('Passphrase Required'),
|
count = 0
|
||||||
_('Enter GPG key passphrase for account %s') % account,
|
title = _('Passphrase Required')
|
||||||
|
second = _('Enter GPG key passphrase for account %s.') % \
|
||||||
|
account
|
||||||
|
while not password_ok and count < 3:
|
||||||
|
count += 1
|
||||||
|
w = dialogs.PassphraseDialog(title, second,
|
||||||
_('Save passphrase'))
|
_('Save passphrase'))
|
||||||
passphrase, save = w.run()
|
passphrase, save = w.run()
|
||||||
if passphrase == -1:
|
if passphrase == -1:
|
||||||
passphrase = None
|
passphrase = None
|
||||||
|
password_ok = True
|
||||||
else:
|
else:
|
||||||
|
password_ok = gajim.connections[account].\
|
||||||
|
test_gpg_passphrase(passphrase)
|
||||||
|
title = _('Wrong Passphrase')
|
||||||
|
second = _('Please retype your GPG passphrase or press Cancel.')
|
||||||
|
if passphrase != None:
|
||||||
self.gpg_passphrase[keyid] = passphrase
|
self.gpg_passphrase[keyid] = passphrase
|
||||||
gobject.timeout_add(30000, self.forget_gpg_passphrase, keyid)
|
gobject.timeout_add(30000, self.forget_gpg_passphrase, keyid)
|
||||||
if save:
|
if save:
|
||||||
|
|
Loading…
Reference in New Issue