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
|
||||
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):
|
||||
signed = ''
|
||||
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]
|
||||
save = False
|
||||
else:
|
||||
w = dialogs.PassphraseDialog(
|
||||
_('Passphrase Required'),
|
||||
_('Enter GPG key passphrase for account %s') % account,
|
||||
password_ok = False
|
||||
count = 0
|
||||
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'))
|
||||
passphrase, save = w.run()
|
||||
if passphrase == -1:
|
||||
passphrase = None
|
||||
password_ok = True
|
||||
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
|
||||
gobject.timeout_add(30000, self.forget_gpg_passphrase, keyid)
|
||||
if save:
|
||||
|
|
Loading…
Reference in New Issue