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,16 +1518,27 @@ _('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')
|
||||||
_('Save passphrase'))
|
second = _('Enter GPG key passphrase for account %s.') % \
|
||||||
passphrase, save = w.run()
|
account
|
||||||
if passphrase == -1:
|
while not password_ok and count < 3:
|
||||||
passphrase = None
|
count += 1
|
||||||
else:
|
w = dialogs.PassphraseDialog(title, second,
|
||||||
self.gpg_passphrase[keyid] = passphrase
|
_('Save passphrase'))
|
||||||
gobject.timeout_add(30000, self.forget_gpg_passphrase, keyid)
|
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:
|
if save:
|
||||||
gajim.config.set_per('accounts', account, 'savegpgpass', True)
|
gajim.config.set_per('accounts', account, 'savegpgpass', True)
|
||||||
gajim.config.set_per('accounts', account, 'gpgpassword',
|
gajim.config.set_per('accounts', account, 'gpgpassword',
|
||||||
|
|
Loading…
Reference in New Issue