[avm] prevent eating up the passphrase when you fail to enter it 2 times, but succeed on the 3rd. see #4164

This commit is contained in:
Yann Leboulanger 2008-08-01 10:22:24 +00:00
parent 23d9413687
commit 9130004249
1 changed files with 11 additions and 11 deletions

View File

@ -69,7 +69,7 @@ def parseLogLevel(arg):
return int(arg) return int(arg)
if arg.isupper(): if arg.isupper():
return getattr(logging, arg) return getattr(logging, arg)
raise ValueError(_("%s is not a valid loglevel"), repr(arg)) raise ValueError(_('%s is not a valid loglevel'), repr(arg))
def parseLogTarget(arg): def parseLogTarget(arg):
arg = arg.lower() arg = arg.lower()
@ -471,21 +471,21 @@ class PassphraseRequest:
self.complete(None) self.complete(None)
def _ok(passphrase, checked, count): def _ok(passphrase, checked, count):
if count < 3: if gajim.connections[account].test_gpg_passphrase(passphrase):
done = gajim.connections[account].test_gpg_passphrase(passphrase) # passphrase is good
else:
done = True
passphrase = None
if done:
self.complete(passphrase) self.complete(passphrase)
else: return
if count < 3:
# ask again # ask again
dialogs.PassphraseDialog(_('Wrong Passphrase'), dialogs.PassphraseDialog(_('Wrong Passphrase'),
_('Please retype your GPG passphrase or press Cancel.'), _('Please retype your GPG passphrase or press Cancel.'),
ok_handler=(_ok, count + 1), cancel_handler=_cancel) ok_handler=(_ok, count + 1), cancel_handler=_cancel)
else:
# user failed 3 times, continue without GPG
self.complete(None)
dialogs.PassphraseDialog(title, second, ok_handler=(_ok, 0), dialogs.PassphraseDialog(title, second, ok_handler=(_ok, 1),
cancel_handler=_cancel) cancel_handler=_cancel)
self.dialog_created = True self.dialog_created = True
@ -1378,7 +1378,7 @@ class Interface:
if '103' in statusCode: if '103' in statusCode:
changes.append(_('room now does not show unavailable members')) changes.append(_('room now does not show unavailable members'))
if '104' in statusCode: if '104' in statusCode:
changes.append(\ changes.append(
_('A non-privacy-related room configuration change has occurred')) _('A non-privacy-related room configuration change has occurred'))
if '170' in statusCode: if '170' in statusCode:
# Can be a presence (see chg_contact_status in groupchat_control.py) # Can be a presence (see chg_contact_status in groupchat_control.py)