From b30a435ce81526e07af1bd83f4afe0e472c054bb Mon Sep 17 00:00:00 2001
From: fanghuiyu <fanghuiyu@huawei.com>
Date: Mon, 30 Sep 2019 16:46:54 +0800
Subject: [PATCH] anaconda: skip checks if no username is set

reason: skip checks if no username is set

Change-Id: Ia18055e17b4014be05eef3b3f9175b5df635a1a5
Signed-off-by: fanghuiyu <fanghuiyu@huawei.com>
---
 pyanaconda/ui/gui/spokes/user.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/user.py b/pyanaconda/ui/gui/spokes/user.py
index f2fd63a..54525e2 100644
--- a/pyanaconda/ui/gui/spokes/user.py
+++ b/pyanaconda/ui/gui/spokes/user.py
@@ -312,6 +312,9 @@ class UserSpoke(FirstbootSpokeMixIn, NormalSpoke, GUISpokeInputCheckHandler):
         self._validity_check.result.status_text_changed.connect(self.set_password_status)
         # check if the password contains non-ascii characters
         self._ascii_check = input_checking.PasswordASCIICheck()
+        # Skip the empty and validity password checks if no username is set
+        self._empty_check.skip = True
+        self._validity_check.skip = True
 
         # register the individual checks with the checker in proper order
         # 0) is the username and fullname valid ?
@@ -474,9 +477,9 @@ class UserSpoke(FirstbootSpokeMixIn, NormalSpoke, GUISpokeInputCheckHandler):
         self.password_confirmation_entry.set_sensitive(password_is_required)
 
         # also disable/enable corresponding password checks
-        self._empty_check.skip = not password_is_required
+        self._empty_check.skip = not password_is_required or not self.username
         self._confirm_check.skip = not password_is_required
-        self._validity_check.skip = not password_is_required
+        self._validity_check.skip = not password_is_required or not self.username
         self._ascii_check.skip = not password_is_required
 
         # and rerun the checks
-- 
2.19.1
