From 1b7d6a795149588eb44c1b33dd7c34fe6669460a Mon Sep 17 00:00:00 2001
From: Vitor Massaru Iha <vitor@massaru.org>
Date: Sun, 8 Oct 2017 15:28:32 -0300
Subject: [PATCH] esp8266/modules/webrepl_setup: Add info about allowed
 password length.

This patch also makes the code more concise by combining the checks for the
password length.
---
 ports/esp8266/modules/webrepl_setup.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/ports/esp8266/modules/webrepl_setup.py b/ports/esp8266/modules/webrepl_setup.py
index d91600e6e..5288c49c0 100644
--- a/ports/esp8266/modules/webrepl_setup.py
+++ b/ports/esp8266/modules/webrepl_setup.py
@@ -17,12 +17,9 @@ def getpass(prompt):
 
 def input_pass():
     while 1:
-        passwd1 = getpass("New password: ")
-        if len(passwd1) < 4:
-            print("Password too short")
-            continue
-        elif len(passwd1) > 9:
-            print("Password too long")
+        passwd1 = getpass("New password (4-9 chars): ")
+        if len(passwd1) < 4 or len(passwd1) > 9:
+            print("Invalid password length")
             continue
         passwd2 = getpass("Confirm password: ")
         if passwd1 == passwd2:
-- 
GitLab