!374 [sync] PR-364: fix: check that the password contains the username

From: @openeuler-sync-bot 
Reviewed-by: @t_feng 
Signed-off-by: @t_feng
This commit is contained in:
openeuler-ci-bot 2024-11-05 03:07:07 +00:00 committed by Gitee
commit 086b8ea66d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 93 additions and 1 deletions

View File

@ -0,0 +1,81 @@
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

View File

@ -1,7 +1,7 @@
%define _empty_manifest_terminate_build 0
Name: anaconda
Version: 36.16.5
Release: 37
Release: 38
Summary: Graphical system installer
License: GPLv2+ and MIT
URL: http://fedoraproject.org/wiki/Anaconda
@ -61,6 +61,8 @@ Patch9025: bugfix-import-new-BlockDev.patch
Patch9026: bugfix-fix-custom-storage-chinese-tip.patch
Patch10000: 0001-add-loongarch-support-for-anaconda.patch
# https://github.com/rhinstaller/anaconda/pull/4235
Patch10001: 0001-check-that-the-password-contains-the-username.patch
%define dasbusver 1.3
@ -316,6 +318,15 @@ update-desktop-database &> /dev/null || :
%{_prefix}/libexec/anaconda/dd_*
%changelog
* Tue Aug 20 2024 songmingliang <songmingliang@uniontech.com> - 36.16.5-38
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: Fix the root user creation GTK GUI not checking if a password
contains the user name.
Fix the non-root user creation Text UI not checking if a password
contains the user name.
* Wed Jun 26 2024 sunhai <sunhai10@huawei.com> - 36.16.5-37
- Type:bugfix
- ID:NA