fix(polkit-agent & locker): Remove the restriction on polkit-agent authentication errors,unset screensaver-dialog no fail delay
- 去除polkit-agent认证错误限制,加入重新认证按钮。取消掉screensaver-dialog no-fail-delay。
This commit is contained in:
parent
22ff78b715
commit
9b492fd253
@ -0,0 +1,53 @@
|
||||
From 5d0ba7b98f745b6090fd9c069bd9cc3d845c5421 Mon Sep 17 00:00:00 2001
|
||||
From: liuxinhao <liuxinhao@kylinsec.com.cn>
|
||||
Date: Mon, 29 May 2023 20:24:57 +0800
|
||||
Subject: [PATCH 1/2] fix(kiran auth): unset screensaver-dialog no fail delay
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 取消掉screensaver-dialog no-fail-delay,开启screensaver-dialog认证时的错误延时,显示出锁定后的提示消息
|
||||
|
||||
Closes #I7937W
|
||||
---
|
||||
lib/login-frame/login-frame.cpp | 8 +++-----
|
||||
src/screensaver-dialog/session-guard-checkpass/main.cpp | 4 +---
|
||||
2 files changed, 4 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/lib/login-frame/login-frame.cpp b/lib/login-frame/login-frame.cpp
|
||||
index e80b057..8e49d84 100644
|
||||
--- a/lib/login-frame/login-frame.cpp
|
||||
+++ b/lib/login-frame/login-frame.cpp
|
||||
@@ -278,11 +278,9 @@ void LoginFrame::onShowPrmpt(const QString& text, PromptType type)
|
||||
void LoginFrame::onAuthComplete(bool authRes)
|
||||
{
|
||||
KLOG_DEBUG() << "auth complete" << authRes;
|
||||
- if (authRes)
|
||||
- {
|
||||
- authenticateComplete(authRes, m_authController->authenticationUser());
|
||||
- }
|
||||
- else
|
||||
+ authenticateComplete(authRes, m_authController->authenticationUser());
|
||||
+
|
||||
+ if( !authRes )
|
||||
{
|
||||
#if 0
|
||||
if (m_prompted)
|
||||
diff --git a/src/screensaver-dialog/session-guard-checkpass/main.cpp b/src/screensaver-dialog/session-guard-checkpass/main.cpp
|
||||
index 92ec34d..9bad98d 100644
|
||||
--- a/src/screensaver-dialog/session-guard-checkpass/main.cpp
|
||||
+++ b/src/screensaver-dialog/session-guard-checkpass/main.cpp
|
||||
@@ -201,9 +201,7 @@ int main(int argc, char *argv[])
|
||||
KLOG_WARNING() << "failed to start pam:" << pam_strerror(pamh, ret);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
-
|
||||
- pam_set_item(pamh, PAM_FAIL_DELAY, (void *)no_fail_delay);
|
||||
-
|
||||
+
|
||||
int authRes = PAM_SUCCESS;
|
||||
authRes = pam_authenticate(pamh, 0);
|
||||
const char *newUserName;
|
||||
--
|
||||
2.33.0
|
||||
|
||||
340
0002-fix-polkit-agent-Remove-the-restriction-on-polkit-ag.patch
Normal file
340
0002-fix-polkit-agent-Remove-the-restriction-on-polkit-ag.patch
Normal file
@ -0,0 +1,340 @@
|
||||
From 0a130f0034a77b5bb764a41f4832bcf224c9381f Mon Sep 17 00:00:00 2001
|
||||
From: liuxinhao <liuxinhao@kylinsec.com.cn>
|
||||
Date: Wed, 31 May 2023 14:29:18 +0800
|
||||
Subject: [PATCH 2/2] fix(polkit-agent): Remove the restriction on polkit-agent
|
||||
authentication errors
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 去除polkit-agent认证错误限制,错误时需要点击左下重新认证按钮重新认证.适应部分认证流程不存在prompt消息
|
||||
|
||||
Closes #I7961L
|
||||
---
|
||||
src/polkit-agent/dialog.cpp | 87 +++++++++++++++---------
|
||||
src/polkit-agent/dialog.h | 11 ++-
|
||||
src/polkit-agent/dialog.ui | 27 +++++++-
|
||||
translations/kiran-polkit-agent.zh_CN.ts | 25 +++++--
|
||||
4 files changed, 110 insertions(+), 40 deletions(-)
|
||||
|
||||
diff --git a/src/polkit-agent/dialog.cpp b/src/polkit-agent/dialog.cpp
|
||||
index 16ca2aa..10fdbc5 100644
|
||||
--- a/src/polkit-agent/dialog.cpp
|
||||
+++ b/src/polkit-agent/dialog.cpp
|
||||
@@ -58,7 +58,7 @@ Dialog::Dialog(QWidget* parent)
|
||||
: KiranTitlebarWindow(parent),
|
||||
ui(new Ui::Dialog)
|
||||
{
|
||||
-ui->setupUi(getWindowContentWidget());
|
||||
+ ui->setupUi(getWindowContentWidget());
|
||||
resize(408, 290);
|
||||
initUI();
|
||||
}
|
||||
@@ -119,24 +119,44 @@ void Dialog::initUI()
|
||||
layout()->setSizeConstraint(QLayout::SetFixedSize);
|
||||
ui->label_tips->setWordWrap(true);
|
||||
Kiran::StylePropertyHelper::setButtonType(ui->btn_ok, Kiran::BUTTON_Default);
|
||||
+ Kiran::StylePropertyHelper::setButtonType(ui->btn_reauth, Kiran::BUTTON_Default);
|
||||
|
||||
+ switchButtonLayout(BUTTON_LAYOUT_NORMAL);
|
||||
+
|
||||
m_switcher = new AuthTypeSwitcher(EXPAND_DIRECTION_BOTTOM, 4, this);
|
||||
m_switcher->setAdjustColorToTheme(true);
|
||||
m_switcher->setFixedSize(QSize(42, 36));
|
||||
m_switcher->setVisible(false);
|
||||
ui->layout_edit->addWidget(m_switcher);
|
||||
- connect(m_switcher, &AuthTypeSwitcher::authTypeChanged, this, &Dialog::onCurrentAuthTypeChanged);
|
||||
+ connect(m_switcher, &AuthTypeSwitcher::authTypeChanged, this, &Dialog::onSwitcherAuthTypeChanged);
|
||||
|
||||
connect(ui->btn_cancel, &QPushButton::clicked, this, &Dialog::onCancelClicked);
|
||||
connect(ui->btn_ok, &QPushButton::clicked, this, &Dialog::onOkClicked);
|
||||
+ connect(ui->btn_reauth,&QPushButton::clicked,this,&Dialog::onReauthClicked);
|
||||
connect(ui->edit->lineEdit(), &QLineEdit::returnPressed, this, &Dialog::onOkClicked);
|
||||
connect(ui->combobox_user, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &Dialog::onCurrentUserChanged);
|
||||
}
|
||||
|
||||
+void Dialog::switchButtonLayout(ButtonLayout layout)
|
||||
+{
|
||||
+ switch (layout)
|
||||
+ {
|
||||
+ case BUTTON_LAYOUT_NORMAL:
|
||||
+ ui->btn_reauth->setVisible(false);
|
||||
+ ui->btn_ok->setVisible(true);
|
||||
+ break;
|
||||
+ case BUTTON_LAYOUT_REAUTH:
|
||||
+ ui->btn_reauth->setVisible(true);
|
||||
+ ui->btn_ok->setVisible(false);
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void Dialog::startAuth(const QString& userName)
|
||||
{
|
||||
m_havePrompt = false;
|
||||
- m_triesCount++;
|
||||
|
||||
if (m_authController->inAuthentication())
|
||||
{
|
||||
@@ -171,29 +191,19 @@ void Dialog::onOkClicked()
|
||||
ui->btn_ok->setEnabled(false);
|
||||
}
|
||||
|
||||
-void Dialog::onCurrentUserChanged(int idx)
|
||||
+void Dialog::onReauthClicked()
|
||||
{
|
||||
startAuth(ui->combobox_user->currentText());
|
||||
}
|
||||
|
||||
-void Dialog::onCurrentAuthTypeChanged(KADAuthType authType)
|
||||
+void Dialog::onCurrentUserChanged(int idx)
|
||||
{
|
||||
- QMap<KADAuthType, QString> authTypeDesc = {
|
||||
- {KAD_AUTH_TYPE_FINGERPRINT, tr("fingerprint auth")},
|
||||
- {KAD_AUTH_TYPE_FACE, tr("face auth")},
|
||||
- {KAD_AUTH_TYPE_FINGERVEIN, tr("fingervein auth")}};
|
||||
+ startAuth(ui->combobox_user->currentText());
|
||||
+}
|
||||
|
||||
- ui->label_tips->setText("");
|
||||
+void Dialog::onSwitcherAuthTypeChanged(KADAuthType authType)
|
||||
+{
|
||||
m_authController->switchAuthType(authType);
|
||||
- ui->edit->setEnabled(false);
|
||||
- ui->btn_ok->setEnabled(false);
|
||||
- ui->edit->lineEdit()->clear();
|
||||
- ui->edit->lineEdit()->setPlaceholderText("");
|
||||
-
|
||||
- if (authTypeDesc.contains(authType))
|
||||
- {
|
||||
- ui->edit->lineEdit()->setPlaceholderText(authTypeDesc[authType]);
|
||||
- }
|
||||
}
|
||||
|
||||
void Dialog::onNotifyAuthMode(KADAuthMode mode)
|
||||
@@ -208,7 +218,29 @@ void Dialog::onSupportedAuthTypeChanged(QList<KADAuthType> authTypes)
|
||||
|
||||
void Dialog::onNotifyAuthTypeChanged(KADAuthType authType)
|
||||
{
|
||||
- m_switcher->setCurrentAuthType(authType);
|
||||
+ if( authType != m_switcher->getCurrentAuthType() )
|
||||
+ {
|
||||
+ QSignalBlocker blocker(m_switcher);
|
||||
+ m_switcher->setCurrentAuthType(authType);
|
||||
+ }
|
||||
+
|
||||
+ QMap<KADAuthType, QString> authTypeDesc = {
|
||||
+ {KAD_AUTH_TYPE_FINGERPRINT, tr("fingerprint auth")},
|
||||
+ {KAD_AUTH_TYPE_FACE, tr("face auth")},
|
||||
+ {KAD_AUTH_TYPE_FINGERVEIN, tr("fingervein auth")},
|
||||
+ {KAD_AUTH_TYPE_IRIS,tr("iris auth")}};
|
||||
+
|
||||
+ switchButtonLayout(BUTTON_LAYOUT_NORMAL);
|
||||
+ ui->label_tips->setText("");
|
||||
+ ui->edit->setEnabled(false);
|
||||
+ ui->btn_ok->setEnabled(false);
|
||||
+ ui->edit->lineEdit()->clear();
|
||||
+ ui->edit->lineEdit()->setPlaceholderText("");
|
||||
+
|
||||
+ if (authTypeDesc.contains(authType))
|
||||
+ {
|
||||
+ ui->edit->lineEdit()->setPlaceholderText(authTypeDesc[authType]);
|
||||
+ }
|
||||
}
|
||||
|
||||
void Dialog::onAuthComplete(bool success)
|
||||
@@ -219,21 +251,13 @@ void Dialog::onAuthComplete(bool success)
|
||||
this->close();
|
||||
return;
|
||||
}
|
||||
-
|
||||
- if (m_havePrompt && (m_triesCount < MAX_ERROR_COUNT))
|
||||
- {
|
||||
- onAuthShowMessage("Authentication error, please authenticate again.", MessageTypeInfo);
|
||||
- startAuth(ui->combobox_user->currentText());
|
||||
- }
|
||||
else
|
||||
{
|
||||
- if (m_triesCount == MAX_ERROR_COUNT)
|
||||
- {
|
||||
- onAuthShowMessage("Authentication error", MessageTypeError);
|
||||
- }
|
||||
- ui->btn_ok->setEnabled(false);
|
||||
+ onAuthShowMessage("Authentication error", MessageTypeError);
|
||||
+
|
||||
ui->edit->lineEdit()->clear();
|
||||
ui->edit->setEnabled(false);
|
||||
+ switchButtonLayout(BUTTON_LAYOUT_REAUTH);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,7 +280,6 @@ void Dialog::onAuthShowMessage(const QString& text, MessageType msgType)
|
||||
|
||||
ui->label_tips->setText(tips);
|
||||
}
|
||||
-
|
||||
} // namespace PolkitAgent
|
||||
} // namespace SessionGuard
|
||||
} // namespace Kiran
|
||||
\ No newline at end of file
|
||||
diff --git a/src/polkit-agent/dialog.h b/src/polkit-agent/dialog.h
|
||||
index fe56251..7fbb85d 100644
|
||||
--- a/src/polkit-agent/dialog.h
|
||||
+++ b/src/polkit-agent/dialog.h
|
||||
@@ -64,6 +64,11 @@ public:
|
||||
class Dialog : public KiranTitlebarWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
+ enum ButtonLayout
|
||||
+ {
|
||||
+ BUTTON_LAYOUT_NORMAL,
|
||||
+ BUTTON_LAYOUT_REAUTH
|
||||
+ };
|
||||
public:
|
||||
explicit Dialog(QWidget* parent = nullptr);
|
||||
~Dialog();
|
||||
@@ -77,14 +82,16 @@ signals:
|
||||
|
||||
private:
|
||||
void initUI();
|
||||
+ void switchButtonLayout(ButtonLayout layout);
|
||||
bool setAuthInfo(const AuthInfo& authInfo);
|
||||
void startAuth(const QString& userName);
|
||||
|
||||
private slots:
|
||||
void onCancelClicked();
|
||||
void onOkClicked();
|
||||
+ void onReauthClicked();
|
||||
void onCurrentUserChanged(int idx);
|
||||
- void onCurrentAuthTypeChanged(KADAuthType authType);
|
||||
+ void onSwitcherAuthTypeChanged(KADAuthType authType);
|
||||
|
||||
void onNotifyAuthMode(KADAuthMode mode);
|
||||
void onSupportedAuthTypeChanged(QList<KADAuthType> authTypes);
|
||||
@@ -102,7 +109,7 @@ private:
|
||||
AuthController* m_authController;
|
||||
AuthTypeSwitcher* m_switcher;
|
||||
bool m_havePrompt = false;
|
||||
- int m_triesCount = 0;
|
||||
+ ButtonLayout m_buttonLayout = BUTTON_LAYOUT_NORMAL;
|
||||
};
|
||||
} // namespace PolkitAgent
|
||||
} // namespace SessionGuard
|
||||
diff --git a/src/polkit-agent/dialog.ui b/src/polkit-agent/dialog.ui
|
||||
index 74120eb..b1d4994 100644
|
||||
--- a/src/polkit-agent/dialog.ui
|
||||
+++ b/src/polkit-agent/dialog.ui
|
||||
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
- <width>407</width>
|
||||
+ <width>410</width>
|
||||
<height>234</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -214,6 +214,31 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
+ <item>
|
||||
+ <widget class="QPushButton" name="btn_reauth">
|
||||
+ <property name="sizePolicy">
|
||||
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
+ <horstretch>0</horstretch>
|
||||
+ <verstretch>0</verstretch>
|
||||
+ </sizepolicy>
|
||||
+ </property>
|
||||
+ <property name="minimumSize">
|
||||
+ <size>
|
||||
+ <width>110</width>
|
||||
+ <height>40</height>
|
||||
+ </size>
|
||||
+ </property>
|
||||
+ <property name="maximumSize">
|
||||
+ <size>
|
||||
+ <width>110</width>
|
||||
+ <height>40</height>
|
||||
+ </size>
|
||||
+ </property>
|
||||
+ <property name="text">
|
||||
+ <string>Recertification</string>
|
||||
+ </property>
|
||||
+ </widget>
|
||||
+ </item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_ok">
|
||||
<property name="sizePolicy">
|
||||
diff --git a/translations/kiran-polkit-agent.zh_CN.ts b/translations/kiran-polkit-agent.zh_CN.ts
|
||||
index 97ce7f8..ae75cc2 100644
|
||||
--- a/translations/kiran-polkit-agent.zh_CN.ts
|
||||
+++ b/translations/kiran-polkit-agent.zh_CN.ts
|
||||
@@ -41,11 +41,16 @@
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/polkit-agent/dialog.ui" line="238"/>
|
||||
+ <source>Recertification</source>
|
||||
+ <translation>重新认证</translation>
|
||||
+ </message>
|
||||
+ <message>
|
||||
+ <location filename="../src/polkit-agent/dialog.ui" line="263"/>
|
||||
<source>Ok</source>
|
||||
<translation>确认</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../src/polkit-agent/dialog.ui" line="279"/>
|
||||
+ <location filename="../src/polkit-agent/dialog.ui" line="304"/>
|
||||
<source>Cancel</source>
|
||||
<translation>取消</translation>
|
||||
</message>
|
||||
@@ -69,7 +74,7 @@
|
||||
<context>
|
||||
<name>Kiran::SessionGuard::AuthController</name>
|
||||
<message>
|
||||
- <location filename="../lib/auth-proxy/auth-controller.cpp" line="275"/>
|
||||
+ <location filename="../lib/auth-proxy/auth-controller.cpp" line="290"/>
|
||||
<source>Failed to authenticate</source>
|
||||
<translation>认证失败</translation>
|
||||
</message>
|
||||
@@ -96,6 +101,16 @@
|
||||
<source>finger vein auth</source>
|
||||
<translation>指静脉认证</translation>
|
||||
</message>
|
||||
+ <message>
|
||||
+ <location filename="../lib/common-widgets/auth-type-switcher.cpp" line="59"/>
|
||||
+ <source>iris auth</source>
|
||||
+ <translation>虹膜认证</translation>
|
||||
+ </message>
|
||||
+ <message>
|
||||
+ <location filename="../lib/common-widgets/auth-type-switcher.cpp" line="60"/>
|
||||
+ <source>ukey auth</source>
|
||||
+ <translation>UKey认证</translation>
|
||||
+ </message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Kiran::SessionGuard::PolkitAgent::Dialog</name>
|
||||
@@ -105,17 +120,17 @@
|
||||
<translation>认证</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../src/polkit-agent/dialog.cpp" line="182"/>
|
||||
+ <location filename="../src/polkit-agent/dialog.cpp" line="187"/>
|
||||
<source>fingerprint auth</source>
|
||||
<translation>指纹认证</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../src/polkit-agent/dialog.cpp" line="183"/>
|
||||
+ <location filename="../src/polkit-agent/dialog.cpp" line="188"/>
|
||||
<source>face auth</source>
|
||||
<translation>人脸认证</translation>
|
||||
</message>
|
||||
<message>
|
||||
- <location filename="../src/polkit-agent/dialog.cpp" line="184"/>
|
||||
+ <location filename="../src/polkit-agent/dialog.cpp" line="189"/>
|
||||
<source>fingervein auth</source>
|
||||
<translation>指静脉认证</translation>
|
||||
</message>
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -1,12 +1,15 @@
|
||||
Name: kiran-session-guard
|
||||
Version: 2.5.1
|
||||
Release: 1
|
||||
Release: 2
|
||||
Summary: Kiran desktop environment login and lock screen dialog
|
||||
Summary(zh_CN): Kiran桌面环境登录和解锁框
|
||||
|
||||
License: MulanPSL-2.0
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
|
||||
Patch0001: 0001-fix-kiran-auth-unset-screensaver-dialog-no-fail-dela.patch
|
||||
Patch0002: 0002-fix-polkit-agent-Remove-the-restriction-on-polkit-ag.patch
|
||||
|
||||
%define SHOW_VIRTUAL_KEYBOARD 0
|
||||
|
||||
BuildRequires: cmake
|
||||
@ -143,6 +146,10 @@ gtk-update-icon-cache -f /usr/share/icons/hicolor/
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%changelog
|
||||
* Wed May 31 2023 liuxinhao <liuxinhao@kylinsec.com.cn> - 2.5.1-2
|
||||
- KYOS-B: unset screensaver-dialog no fail delay(#I7937W)
|
||||
- KYOS-B: Remove the restriction on polkit-agent authentication errors(#I7961L)
|
||||
|
||||
* Wed May 24 2023 liuxinhao <liuxinhao@kylinsec.com.cn> - 2.5.1-1
|
||||
- KYOS-F: If the authentication fails, the re-authentication button is displayed.(#69229)
|
||||
- KYOS-B: Fixed an issue caused by selecting default desktop session(#69204,#69220)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user