12 Star 13 Fork 107

src-openEuler/anaconda

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-check-that-the-password-contains-the-username.patch 3.36 KB
一键复制 编辑 原始数据 按行查看 历史
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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/anaconda.git
git@gitee.com:src-openeuler/anaconda.git
src-openeuler
anaconda
anaconda
master

搜索帮助