URI: 
       tkivy pw dialog: don't enforce min length for existing generic password - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 60ad5e6a52acafbf5522fab9ff3934ac046672de
   DIR parent 2aebcc5e26608cbbc7c9f1332268338ca8f6242c
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Thu,  5 Mar 2020 18:09:17 +0100
       
       kivy pw dialog: don't enforce min length for existing generic password
       
       tthis allows opening short-password wallets on desktop
       
       Diffstat:
         M electrum/gui/kivy/uix/dialogs/pass… |       8 +++++---
       
       1 file changed, 5 insertions(+), 3 deletions(-)
       ---
   DIR diff --git a/electrum/gui/kivy/uix/dialogs/password_dialog.py b/electrum/gui/kivy/uix/dialogs/password_dialog.py
       t@@ -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
       t@@ -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