Kaynağa Gözat

fix silly bug when reading password length

oz123 11 yıl önce
ebeveyn
işleme
3ee3b05265
2 değiştirilmiş dosya ile 7 ekleme ve 3 silme
  1. 4 2
      pwman/ui/cli.py
  2. 3 1
      pwman/ui/win.py

+ 4 - 2
pwman/ui/cli.py

@@ -110,7 +110,7 @@ class PwmanCli(cmd.Cmd):
         """
         if argsgiven == 1:
             length = tools.getinput("Password length (default 7): ", "7")
-            length = int(length)
+            length = len(length)
             password, dumpme = generator.generate_password(length, length,
                                                            True, leetify,
                                                            numerics,
@@ -122,8 +122,10 @@ class PwmanCli(cmd.Cmd):
                                      tools._defaultwidth, False)
         if len(password) == 0:
             length = tools.getinput("Password length (default 7): ", "7")
+        if length:
             length = int(length)
-
+        else: 
+            length = 7
             (password, dumpme) = generator.generate_password(length, length,
                                                              True, leetify,
                                                              numerics,

+ 3 - 1
pwman/ui/win.py

@@ -32,7 +32,9 @@ import ast
 from pwman.util.crypto import zerome
 
 class PwmanCliWinNew(PwmanCliNew):
-
+    """
+    windows ui class
+    """
     def do_new(self, args):
         """
         can override default config settings the following way: