Browse Source

kivy pw dialog: don't enforce min length for existing generic password

this allows opening short-password wallets on desktop
master
SomberNight 6 years ago
parent
commit
60ad5e6a52
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
  1. 8
      electrum/gui/kivy/uix/dialogs/password_dialog.py

8
electrum/gui/kivy/uix/dialogs/password_dialog.py

@ -115,7 +115,7 @@ class PasswordDialog(Factory.Popup):
check_password = None,
on_success: Callable = None, on_failure: Callable = None,
is_change: bool = False,
is_password: bool = True,
is_password: bool = True, # whether this is for a generic password or for a numeric PIN
has_password: bool = False,
message: str = ''):
self.app = app
@ -179,11 +179,13 @@ class PasswordDialog(Factory.Popup):
def on_password(self, pw: str):
if self.is_generic:
# if setting new generic password, enforce min length
if self.is_generic and self.level > 0:
if len(pw) < 6:
self.app.show_error(_('Password is too short (min {} characters)').format(6))
return
if len(pw) >= 6:
# PIN codes are exactly 6 chars; generic pw can be any (don't enforce minimum on existing)
if len(pw) >= 6 or self.is_generic:
if self.check_password(pw):
if self.is_change is False:
self.success = True

Loading…
Cancel
Save