From 6b89a0dbab8b63644a25eb89e404ce2ceec24503 Mon Sep 17 00:00:00 2001
From: huayadong <huayadong@kylinos.cn>
Date: Tue, 19 Nov 2024 10:52:43 +0800
Subject: [PATCH] fix unable to input password

---
 src/lockwidget.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/lockwidget.cpp b/src/lockwidget.cpp
index ac11367..582c25d 100644
--- a/src/lockwidget.cpp
+++ b/src/lockwidget.cpp
@@ -42,6 +42,7 @@
 #include "commonfunc.h"
 #include "hoverwidget.h"
 #include "kylinnm.h"
+#include <pwd.h>
 
 #include <QtX11Extras/QX11Info>
 #include <X11/Xlib.h>
@@ -681,12 +682,18 @@ void LockWidget::onUserMenuTrigged(QAction *action)
 {
     qDebug() << action->data().toString() << "selected";
 
+    QString userName = action->data().toString();
+    struct passwd *pw = getpwuid(geteuid());
+    QString localname = QString::fromLocal8Bit(pw->pw_name);
+    if (userName.compare(localname) == 0) {
+        return;
+    }
+
     if(authDialog)
     {
         authDialog->stopAuth();
     }
 
-    QString userName = action->data().toString();
     for (int i =0; i < list.count(); i++)
     {
             if(list.at(i)->objectName() == userName){
-- 
2.46.0

