代码拉取完成,页面将自动刷新
From f5882812416bf30f840b1c683ad8f4bac459a82d Mon Sep 17 00:00:00 2001
From: songmingliang <songmingliang@uniontech.com>
Date: Tue, 20 Aug 2024 16:04:58 +0800
Subject: [PATCH] check that the password contains the username
---
pyanaconda/ui/gui/spokes/root_password.py | 2 ++
pyanaconda/ui/tui/spokes/root_password.py | 1 +
pyanaconda/ui/tui/spokes/user.py | 1 +
pyanaconda/ui/tui/tuiobject.py | 11 +++++++++++
4 files changed, 15 insertions(+)
diff --git a/pyanaconda/ui/gui/spokes/root_password.py b/pyanaconda/ui/gui/spokes/root_password.py
index a9157ab..90eda48 100644
--- a/pyanaconda/ui/gui/spokes/root_password.py
+++ b/pyanaconda/ui/gui/spokes/root_password.py
@@ -101,6 +101,8 @@ class PasswordSpoke(FirstbootSpokeMixIn, NormalSpoke, GUISpokeInputCheckHandler)
initial_password_confirmation_content=self.password_confirmation,
policy_name=PASSWORD_POLICY_ROOT
)
+ # configure root username for checking
+ self.checker.username = "root"
# configure the checker for password checking
self.checker.secret_type = constants.SecretType.PASSWORD
# remove any placeholder texts if either password or confirmation field changes content from initial state
diff --git a/pyanaconda/ui/tui/spokes/root_password.py b/pyanaconda/ui/tui/spokes/root_password.py
index dfaca4e..2dc39c0 100644
--- a/pyanaconda/ui/tui/spokes/root_password.py
+++ b/pyanaconda/ui/tui/spokes/root_password.py
@@ -151,6 +151,7 @@ class RootPasswordSpoke(NormalTUISpoke):
func_args=(algo,)
)
password_dialog.no_separator = True
+ password_dialog.username = "root"
self._password = password_dialog.run()
if self._password is None:
diff --git a/pyanaconda/ui/tui/spokes/user.py b/pyanaconda/ui/tui/spokes/user.py
index a107063..e914c1c 100644
--- a/pyanaconda/ui/tui/spokes/user.py
+++ b/pyanaconda/ui/tui/spokes/user.py
@@ -148,6 +148,7 @@ class UserSpoke(FirstbootSpokeMixIn, NormalTUISpoke):
title=_("Password"),
policy_name=PASSWORD_POLICY_USER
)
+ password_dialog.username = self.user.name
if self.user.password:
entry = EntryWidget(password_dialog.title, _(PASSWORD_SET))
else:
diff --git a/pyanaconda/ui/tui/tuiobject.py b/pyanaconda/ui/tui/tuiobject.py
index c642931..5a7f9a0 100644
--- a/pyanaconda/ui/tui/tuiobject.py
+++ b/pyanaconda/ui/tui/tuiobject.py
@@ -218,6 +218,15 @@ class PasswordDialog(Dialog):
self._process_password = process_func
self._func_args = func_args
self._dialog_message = message
+ self._username = ""
+
+ @property
+ def username(self):
+ return self._username
+
+ @username.setter
+ def username(self, new_username):
+ self._username = new_username
def run(self):
"""Get password input from user and call setter callback at the end.
@@ -259,6 +268,8 @@ class PasswordDialog(Dialog):
password_check_request.password = password
password_check_request.password_confirmation = ""
password_check_request.policy = self._policy
+ # configure username for checking
+ password_check_request.username = self.username
# validate the password
password_check = input_checking.PasswordValidityCheck()
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。