同步主线最新代码

This commit is contained in:
winnerym 2022-10-17 19:20:36 +08:00
parent 71d735eec8
commit 47d46b5422
67 changed files with 3969 additions and 564 deletions

View File

@ -26,6 +26,7 @@ add_subdirectory(bioauth)
add_subdirectory(bioauth-bin) add_subdirectory(bioauth-bin)
add_subdirectory(pam-biometric) add_subdirectory(pam-biometric)
add_subdirectory(polkit-agent) add_subdirectory(polkit-agent)
add_subdirectory(uniauth-backend)
add_subdirectory(images) add_subdirectory(images)
add_dependencies(bioauth BioAuth) add_dependencies(bioauth BioAuth)

View File

@ -41,7 +41,7 @@
<location filename="../src/main.cpp" line="135"/> <location filename="../src/main.cpp" line="135"/>
<location filename="../src/main.cpp" line="170"/> <location filename="../src/main.cpp" line="170"/>
<location filename="../src/main.cpp" line="179"/> <location filename="../src/main.cpp" line="179"/>
<location filename="../src/main.cpp" line="315"/> <location filename="../src/main.cpp" line="323"/>
<source>AUTHENTICATION CANCELED</source> <source>AUTHENTICATION CANCELED</source>
<translation></translation> <translation></translation>
</message> </message>
@ -91,7 +91,12 @@
<translation>Q或者Esc取消</translation> <translation>Q或者Esc取消</translation>
</message> </message>
<message> <message>
<location filename="../src/main.cpp" line="263"/> <location filename="../src/main.cpp" line="267"/>
<source>BIOMETRIC AUTHENTICATION IS CLOSED</source>
<translation></translation>
</message>
<message>
<location filename="../src/main.cpp" line="271"/>
<source>AUTHENTICATION SUCCESS</source> <source>AUTHENTICATION SUCCESS</source>
<translation></translation> <translation></translation>
</message> </message>

View File

@ -237,12 +237,13 @@ int main(int argc, char *argv[])
exit(BIO_ERROR); exit(BIO_ERROR);
BioDevices bioDevices(true); BioDevices bioDevices(true);
bioDevices.setUId(uid);
int maxFailedTimes = bioDevices.getFailedTimes(); int maxFailedTimes = bioDevices.getFailedTimes();
int failedTimes = 0;
DeviceInfoPtr deviceInfo = bioDevices.getDefaultDevice(uid); DeviceInfoPtr deviceInfo = bioDevices.getDefaultDevice(uid);
bool isHiddenSwitchButton = bioDevices.GetHiddenSwitchButton(); bool isHiddenSwitchButton = bioDevices.GetHiddenSwitchButton();
if(!deviceInfo) if(!deviceInfo){ // 只检查默认设备,不再使用第一个设备
exit(BIO_ERROR); exit(BIO_ERROR);
}
if(bioDevices.getFeatureCount(uid)<1) if(bioDevices.getFeatureCount(uid)<1)
exit(BIO_ERROR); exit(BIO_ERROR);
@ -259,6 +260,11 @@ int main(int argc, char *argv[])
QObject::connect(&bioAuth, &BioAuth::authComplete, &a, [&](uid_t uid_, int result, int retErrNo){ QObject::connect(&bioAuth, &BioAuth::authComplete, &a, [&](uid_t uid_, int result, int retErrNo){
Q_UNUSED(retErrNo); Q_UNUSED(retErrNo);
watcher.stop(); watcher.stop();
bool isBioEnable = bioDevices.GetBioAuthEnable(uid_);
if(!isBioEnable){
showMessage(QObject::tr("BIOMETRIC AUTHENTICATION IS CLOSED"), RESULT);
exit(BIO_IGNORE);
}
if(result && uid == uid_) { if(result && uid == uid_) {
showMessage(QObject::tr("AUTHENTICATION SUCCESS"), RESULT); showMessage(QObject::tr("AUTHENTICATION SUCCESS"), RESULT);
exit(BIO_SUCCESS); exit(BIO_SUCCESS);

View File

@ -6,6 +6,7 @@ qt5_wrap_ui(BioAuthWidgets_SRC
qt5_wrap_cpp(BioAuth_SRC qt5_wrap_cpp(BioAuth_SRC
include/bioauth.h include/bioauth.h
include/biodevices.h include/biodevices.h
include/uniauthservice.h
) )
qt5_wrap_cpp(BioAuthWidgets_SRC qt5_wrap_cpp(BioAuthWidgets_SRC
include/bioauthwidget.h include/bioauthwidget.h
@ -19,6 +20,7 @@ set(BioAuth_SRC
src/bioauth.cpp src/bioauth.cpp
src/biodevices.cpp src/biodevices.cpp
src/biotypes.cpp src/biotypes.cpp
src/uniauthservice.cpp
) )
set(BioAuthWidgets_SRC set(BioAuthWidgets_SRC

View File

@ -34,52 +34,52 @@
<context> <context>
<name>BioDevices</name> <name>BioDevices</name>
<message> <message>
<location filename="../src/biodevices.cpp" line="63"/> <location filename="../src/biodevices.cpp" line="64"/>
<source>Unplugging of %1 device detected</source> <source>Unplugging of %1 device detected</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="73"/> <location filename="../src/biodevices.cpp" line="74"/>
<source>%1 device insertion detected</source> <source>%1 device insertion detected</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="82"/> <location filename="../src/biodevices.cpp" line="83"/>
<source>ukui-biometric-manager</source> <source>ukui-biometric-manager</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="85"/> <location filename="../src/biodevices.cpp" line="86"/>
<source>biometric</source> <source>biometric</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="351"/> <location filename="../src/biodevices.cpp" line="457"/>
<source>FingerPrint</source> <source>FingerPrint</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="353"/> <location filename="../src/biodevices.cpp" line="459"/>
<source>FingerVein</source> <source>FingerVein</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="355"/> <location filename="../src/biodevices.cpp" line="461"/>
<source>Iris</source> <source>Iris</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="357"/> <location filename="../src/biodevices.cpp" line="463"/>
<source>Face</source> <source>Face</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="359"/> <location filename="../src/biodevices.cpp" line="465"/>
<source>VoicePrint</source> <source>VoicePrint</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="361"/> <location filename="../src/biodevices.cpp" line="467"/>
<source>QRCode</source> <source>QRCode</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -95,7 +95,7 @@
<context> <context>
<name>LoginOptionsWidget</name> <name>LoginOptionsWidget</name>
<message> <message>
<location filename="../src/loginoptionswidget.cpp" line="57"/> <location filename="../src/loginoptionswidget.cpp" line="59"/>
<source>Login Options</source> <source>Login Options</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View File

@ -29,15 +29,15 @@
</message> </message>
<message> <message>
<source>%1 too many unsuccessful attempts,please enter password.</source> <source>%1 too many unsuccessful attempts,please enter password.</source>
<translation type="unfinished"></translation> <translation>%1</translation>
</message> </message>
<message> <message>
<source>%1 authentication failure,there are still %2 remaining opportunities</source> <source>%1 authentication failure,there are still %2 remaining opportunities</source>
<translation type="unfinished"></translation> <translation>%1 %2</translation>
</message> </message>
<message> <message>
<source>Please use wechat to scan the code</source> <source>Please use wechat to scan the code</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
</context> </context>
<context> <context>
@ -52,7 +52,7 @@
</message> </message>
<message> <message>
<source>biometric</source> <source>biometric</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<source>VoicePrint</source> <source>VoicePrint</source>
@ -60,11 +60,11 @@
</message> </message>
<message> <message>
<source>Unplugging of %1 device detected</source> <source>Unplugging of %1 device detected</source>
<translation>%1</translation> <translation>%1</translation>
</message> </message>
<message> <message>
<source>%1 device insertion detected</source> <source>%1 device insertion detected</source>
<translation>%1</translation> <translation>%1</translation>
</message> </message>
<message> <message>
<source>FingerPrint</source> <source>FingerPrint</source>
@ -76,11 +76,11 @@
</message> </message>
<message> <message>
<source>ukui-biometric-manager</source> <source>ukui-biometric-manager</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<source>QRCode</source> <source>QRCode</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
</context> </context>
<context> <context>
@ -106,7 +106,7 @@
<name>LoginOptionsWidget</name> <name>LoginOptionsWidget</name>
<message> <message>
<source>Login Options</source> <source>Login Options</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
</context> </context>
</TS> </TS>

View File

@ -46,52 +46,52 @@
<context> <context>
<name>BioDevices</name> <name>BioDevices</name>
<message> <message>
<location filename="../src/biodevices.cpp" line="63"/> <location filename="../src/biodevices.cpp" line="64"/>
<source>Unplugging of %1 device detected</source> <source>Unplugging of %1 device detected</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="73"/> <location filename="../src/biodevices.cpp" line="74"/>
<source>%1 device insertion detected</source> <source>%1 device insertion detected</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="82"/> <location filename="../src/biodevices.cpp" line="83"/>
<source>ukui-biometric-manager</source> <source>ukui-biometric-manager</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="85"/> <location filename="../src/biodevices.cpp" line="86"/>
<source>biometric</source> <source>biometric</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="351"/> <location filename="../src/biodevices.cpp" line="457"/>
<source>FingerPrint</source> <source>FingerPrint</source>
<translation>Parmak İzi</translation> <translation>Parmak İzi</translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="353"/> <location filename="../src/biodevices.cpp" line="459"/>
<source>FingerVein</source> <source>FingerVein</source>
<translation>Damar İzi</translation> <translation>Damar İzi</translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="355"/> <location filename="../src/biodevices.cpp" line="461"/>
<source>Iris</source> <source>Iris</source>
<translation>Göz</translation> <translation>Göz</translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="357"/> <location filename="../src/biodevices.cpp" line="463"/>
<source>Face</source> <source>Face</source>
<translation>Yüz</translation> <translation>Yüz</translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="359"/> <location filename="../src/biodevices.cpp" line="465"/>
<source>VoicePrint</source> <source>VoicePrint</source>
<translation>Ses İzi</translation> <translation>Ses İzi</translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="361"/> <location filename="../src/biodevices.cpp" line="467"/>
<source>QRCode</source> <source>QRCode</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -123,7 +123,7 @@
<context> <context>
<name>LoginOptionsWidget</name> <name>LoginOptionsWidget</name>
<message> <message>
<location filename="../src/loginoptionswidget.cpp" line="57"/> <location filename="../src/loginoptionswidget.cpp" line="59"/>
<source>Login Options</source> <source>Login Options</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View File

@ -54,52 +54,52 @@
<context> <context>
<name>BioDevices</name> <name>BioDevices</name>
<message> <message>
<location filename="../src/biodevices.cpp" line="63"/> <location filename="../src/biodevices.cpp" line="64"/>
<source>Unplugging of %1 device detected</source> <source>Unplugging of %1 device detected</source>
<translation>%1</translation> <translation>%1</translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="73"/> <location filename="../src/biodevices.cpp" line="74"/>
<source>%1 device insertion detected</source> <source>%1 device insertion detected</source>
<translation>%1</translation> <translation>%1</translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="82"/> <location filename="../src/biodevices.cpp" line="83"/>
<source>ukui-biometric-manager</source> <source>ukui-biometric-manager</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="85"/> <location filename="../src/biodevices.cpp" line="86"/>
<source>biometric</source> <source>biometric</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="351"/> <location filename="../src/biodevices.cpp" line="457"/>
<source>FingerPrint</source> <source>FingerPrint</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="353"/> <location filename="../src/biodevices.cpp" line="459"/>
<source>FingerVein</source> <source>FingerVein</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="355"/> <location filename="../src/biodevices.cpp" line="461"/>
<source>Iris</source> <source>Iris</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="357"/> <location filename="../src/biodevices.cpp" line="463"/>
<source>Face</source> <source>Face</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="359"/> <location filename="../src/biodevices.cpp" line="465"/>
<source>VoicePrint</source> <source>VoicePrint</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/biodevices.cpp" line="361"/> <location filename="../src/biodevices.cpp" line="467"/>
<source>QRCode</source> <source>QRCode</source>
<translation></translation> <translation></translation>
</message> </message>
@ -135,7 +135,7 @@
<context> <context>
<name>LoginOptionsWidget</name> <name>LoginOptionsWidget</name>
<message> <message>
<location filename="../src/loginoptionswidget.cpp" line="57"/> <location filename="../src/loginoptionswidget.cpp" line="59"/>
<source>Login Options</source> <source>Login Options</source>
<translation></translation> <translation></translation>
</message> </message>
@ -144,9 +144,8 @@
<translation type="vanished"></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<location filename="../src/loginoptionswidget.cpp" line="57"/>
<source>Biometric</source> <source>Biometric</source>
<translation></translation> <translation type="vanished"></translation>
</message> </message>
</context> </context>
<context> <context>

View File

@ -22,6 +22,7 @@
#include <QMap> #include <QMap>
#include <QList> #include <QList>
#include "biotypes.h" #include "biotypes.h"
#include "uniauthservice.h"
class QDBusInterface; class QDBusInterface;
@ -39,6 +40,7 @@ public:
explicit BioDevices(bool isIgnoreQrCode = false, QObject *parent = nullptr); explicit BioDevices(bool isIgnoreQrCode = false, QObject *parent = nullptr);
int count(); int count();
void setUId(int nUId);
QMap<int, QList<DeviceInfo>> getAllDevices(); QMap<int, QList<DeviceInfo>> getAllDevices();
QMap<int, QList<DeviceInfo>> getUserDevices(int uid); QMap<int, QList<DeviceInfo>> getUserDevices(int uid);
QList<DeviceInfo> getDevices(int type); QList<DeviceInfo> getDevices(int type);
@ -59,6 +61,7 @@ public:
bool GetHiddenSwitchButton(); bool GetHiddenSwitchButton();
bool GetQRCodeEnable(); bool GetQRCodeEnable();
bool GetBioAuthEnable(); bool GetBioAuthEnable();
QStringList getAllDefDevices();
/** /**
* @brief UpdateStatus * @brief UpdateStatus
* @param drvid id * @param drvid id
@ -66,6 +69,7 @@ public:
* int devStatus, int opsStatus, notifyMessageId, ...> * int devStatus, int opsStatus, notifyMessageId, ...>
*/ */
StatusReslut UpdateStatus(int drvid); StatusReslut UpdateStatus(int drvid);
bool GetBioAuthEnable(uid_t uid);
private: private:
void connectToService(); void connectToService();
@ -83,6 +87,9 @@ private:
bool isShowHotPlug; bool isShowHotPlug;
bool useFirstDevice; bool useFirstDevice;
bool m_isIgnoreQrCode = false; bool m_isIgnoreQrCode = false;
UniAuthService *m_uniAuthService = nullptr;
int m_nUId = -1;
QList<int> m_listPriority;
}; };

View File

@ -62,6 +62,104 @@ enum DBusResult {
DBUS_RESULT_PERMISSIONDENIED DBUS_RESULT_PERMISSIONDENIED
}; };
/**
* @brief Identifyops状态
*/
/* 定义操作类型 */
typedef enum {
OPS_TYPE_COMM = 0,
OPS_TYPE_OPEN,
OPS_TYPE_ENROLL,
OPS_TYPE_VERIFY,
OPS_TYPE_IDENTIFY,
OPS_TYPE_CAPTURE,
OPS_TYPE_SEARCH,
OPS_TYPE_CLEAN,
OPS_TYPE_GET_FLIST,
OPS_TYPE_RENAME,
OPS_TYPE_CLOSE,
}BioOpsType;
/*
*
*/
typedef enum {
OPS_COMM_SUCCESS = OPS_TYPE_COMM * 100, /** 空闲状态 **/
OPS_COMM_FAIL, /** 操作失败 **/
OPS_COMM_NO_MATCH = OPS_COMM_FAIL, /** 不匹配 **/
OPS_COMM_ERROR, /** 通用操作错误 **/
OPS_COMM_STOP_BY_USER, /** 用户取消 **/
OPS_COMM_TIMEOUT, /** 操作超时 **/
OPS_COMM_OUT_OF_MEM, /** 无法分配内存 **/
OPS_COMM_MAX,
OPS_OPEN_SUCCESS = OPS_TYPE_OPEN * 100, /** 打开设备完成 **/
OPS_OPEN_FAIL, /** 打开设备失败 **/
OPS_OPEN_ERROR, /** 打开设备遇到错误 **/
OPS_OPEN_MAX,
OPS_ENROLL_SUCCESS = OPS_TYPE_ENROLL * 100, /** 录入信息成功 **/
OPS_ENROLL_FAIL, /** 录入失败 **/
OPS_ENROLL_ERROR, /** 录入过程中遇到错误 **/
OPS_ENROLL_STOP_BY_USER, /** 录入被用户中断 **/
OPS_ENROLL_TIMEOUT, /** 操作超时 **/
OPS_ENROLL_MAX,
OPS_VERIFY_MATCH = OPS_TYPE_VERIFY * 100, /** 认证匹配 **/
OPS_VERIFY_NO_MATCH, /** 认证不匹配 **/
OPS_VERIFY_ERROR, /** 认证过程中遇到错误 **/
OPS_VERIFY_STOP_BY_USER, /** 认证被用户中断 **/
OPS_VERIFY_TIMEOUT, /** 操作超时 **/
OPS_VERIFY_MAX,
OPS_IDENTIFY_MATCH = OPS_TYPE_IDENTIFY * 100, /** 识别到指定特征 **/
OPS_IDENTIFY_NO_MATCH, /** 未识别出指定特征 **/
OPS_IDENTIFY_ERROR, /** 识别过程中遇到错误 **/
OPS_IDENTIFY_STOP_BY_USER, /** 识别被用户中断 **/
OPS_IDENTIFY_TIMEOUT, /** 操作超时 **/
OPS_IDENTIFY_MAX,
OPS_CAPTURE_SUCCESS = OPS_TYPE_CAPTURE * 100, /** 捕获成功 **/
OPS_CAPTURE_FAIL, /** 捕获失败 **/
OPS_CAPTURE_ERROR, /** 捕获过程中遇到错误 **/
OPS_CAPTURE_STOP_BY_USER, /** 捕获被用户中断 **/
OPS_CAPTURE_TIMEOUT, /** 操作超时 **/
OPS_CAPTURE_MAX,
OPS_SEARCH_MATCH = OPS_TYPE_SEARCH * 100, /** 搜索到指定特征 **/
OPS_SEARCH_NO_MATCH, /** 未搜索到指定特征 **/
OPS_SEARCH_ERROR, /** 搜索过程中遇到错误 **/
OPS_SEARCH_STOP_BY_USER, /** 搜索被用户中断 **/
OPS_SEARCH_TIMEOUT, /** 操作超时 **/
OPS_SEARCH_MAX,
OPS_CLEAN_SUCCESS = OPS_TYPE_CLEAN * 100, /** 清理特征成功 **/
OPS_CLEAN_FAIL, /** 清理失败 **/
OPS_CLEAN_ERROR, /** 清理过程中遇到错误 **/
OPS_CLEAN_STOP_BY_USER, /** 清理被用户中断 **/
OPS_CLEAN_TIMEOUT, /** 操作超时 **/
OPS_CLEAN_MAX,
OPS_GET_FLIST_SUCCESS = OPS_TYPE_GET_FLIST * 100, /** 获取特征列表完成 **/
OPS_GET_FLIST_FAIL, /** 获取特征列表失败 **/
OPS_GET_FLIST_ERROR, /** 获取特征列表过程中遇到错误 **/
OPS_GET_FLIST_STOP_BY_USER, /** 获取特征列表被用户中断 **/
OPS_GET_FLIST_TIMEOUT, /** 获取特征列表超时 **/
OPS_GET_FLIST_MAX,
OPS_RENAME_SUCCESS = OPS_TYPE_RENAME * 100, /** 重命名特征完成 **/
OPS_RENAME_FAIL, /** 重命名特征失败 **/
OPS_RENAME_ERROR, /** 重命名特征过程中遇到错误 **/
OPS_RENAME_STOP_BY_USER, /** 重命名特征被用户中断 **/
OPS_RENAME_TIMEOUT, /** 重命名特征超时 **/
OPS_RENAME_MAX,
OPS_CLOSE_SUCCESS = OPS_TYPE_CLOSE * 100, /** 关闭设备完成 **/
OPS_CLOSE_FAIL, /** 关闭设备失败 **/
OPS_CLOSE_ERROR, /** 关闭设备过程中遇到错误 **/
OPS_CLOSE_MAX,
}OpsResult;
/** /**
* @brief UpdateStauts调用返回的结果 * @brief UpdateStauts调用返回的结果
*/ */

View File

@ -45,6 +45,7 @@ public:
DeviceInfoPtr findDeviceByName(const QString &name); DeviceInfoPtr findDeviceByName(const QString &name);
void setDeviceDisable(int nDevId, bool bDisable = true); void setDeviceDisable(int nDevId, bool bDisable = true);
bool isDeviceDisable(int nDevId); bool isDeviceDisable(int nDevId);
void lockStatusChanged(bool locked);
/** /**
* @brief * @brief
@ -71,6 +72,7 @@ public:
bool isAuthenticating() { bool isAuthenticating() {
return m_isInAuth; return m_isInAuth;
} }
QPixmap loadSvg(QString path, QString color, int size);
public slots: public slots:
void readDevicesInfo(); void readDevicesInfo();
@ -99,11 +101,10 @@ private:
void clearOptionButtons(); void clearOptionButtons();
void updateOptionButtons(); void updateOptionButtons();
void startAuth_(); void startAuth_();
bool getAuthDouble();
QPixmap PixmapToRound(const QPixmap &src, int radius); QPixmap PixmapToRound(const QPixmap &src, int radius);
QPixmap scaledPixmap(int width, int height, QString url); QPixmap scaledPixmap(int width, int height, QString url);
QPixmap loadSvg(QString path, QString color, int size);
QPixmap drawSymbolicColoredPixmap(QPixmap &source, QString cgColor); QPixmap drawSymbolicColoredPixmap(QPixmap &source, QString cgColor);
void updatePixmap();
private: private:
BioAuth *m_biomericProxy = nullptr; BioAuth *m_biomericProxy = nullptr;
@ -129,10 +130,14 @@ private:
QMap<int, QToolButton*> m_mapOptBtns; QMap<int, QToolButton*> m_mapOptBtns;
QWidget *m_widgetImage = nullptr; QWidget *m_widgetImage = nullptr;
QLabel *m_labelFace = nullptr; QLabel *m_labelFace = nullptr;
QLabel *m_labelFaceLoad = nullptr;
QLabel *m_labelQRCode = nullptr; // 二维码图标 QLabel *m_labelQRCode = nullptr; // 二维码图标
QLabel *m_labelQRCodeMsg = nullptr; // 二维码状态消息提示 QLabel *m_labelQRCodeMsg = nullptr; // 二维码状态消息提示
QLabel *m_labelQRCodeTip = nullptr; QLabel *m_labelQRCodeTip = nullptr;
QMap<int, QMap<int,bool>> m_mapDisableDev; QMap<int, QMap<int,bool>> m_mapDisableDev;
bool is_Lock = false;
QPixmap m_waitingPixmap;
QTimer *w_timer;
}; };
#endif // LOGINOPTIONSWIDGET_H #endif // LOGINOPTIONSWIDGET_H

View File

@ -0,0 +1,78 @@
/*
* Copyright (C) 2022 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
**/
#ifndef UNIAUTH_SERVICE_H
#define UNIAUTH_SERVICE_H
#include <QtDBus>
#include <QDBusAbstractInterface>
enum authEnableType {
ENABLETYPE_BIO, // 全局总使能
ENABLETYPE_SAVER, // 锁屏
ENABLETYPE_GREETER, // 登录
ENABLETYPE_POLKIT, // 授权
ENABLETYPE_SU, // 暂保留
ENABLETYPE_SUDO, // 暂保留
ENABLETYPE_LOGIN, // 暂保留
};
class UniAuthService : public QDBusAbstractInterface
{
Q_OBJECT
public:
explicit UniAuthService(QObject *parent = nullptr);
public Q_SLOTS:
// 设置默认设备
void setDefaultDevice(int bioDevType, QString deviceName);
// 获取默认设备
QString getDefaultDevice(QString userName, int bioDevType);
// 获取所有默认设备
QStringList getAllDefaultDevice(QString userName);
//生物特征开关接口
bool getBioAuthStatus(QString userName, int bioAuthType);
void setBioAuthStatus(int bioAuthType, bool status);
// 获取最大失败次数
int getMaxFailedTimes();
// 获取是否使能微信扫码登录
bool getQRCodeEnable();
// 获取是否双认证
bool getDoubleAuth();
// 获取用户绑定
bool getUserBind();
// 获取是否在控制面板显示
bool getIsShownInControlCenter();
// 获取是否使用第一个设备
bool getUseFirstDevice();
// 获取是否隐藏切换按钮
bool getHiddenSwitchButton();
public:
bool isActivatable();
Q_SIGNALS:
//默认设备改变
void defaultDeviceChanged(QString userName, int bioDevType, QString deviceName);
//开关状态改变
void bioAuthStatusChanged(QString userName, int type, bool status);
private:
bool m_isActivatable;
};
#endif // UNIAUTH_SERVICE_H

View File

@ -29,14 +29,26 @@
BioDevices::BioDevices(bool isIgnoreQrCode, QObject *parent) BioDevices::BioDevices(bool isIgnoreQrCode, QObject *parent)
: QObject(parent), : QObject(parent),
m_uniAuthService(new UniAuthService(this)),
isShowHotPlug(false), isShowHotPlug(false),
useFirstDevice(false), useFirstDevice(false),
m_isIgnoreQrCode(isIgnoreQrCode) m_isIgnoreQrCode(isIgnoreQrCode)
{ {
connectToService(); connectToService();
getDevicesList();
useFirstDevice = getUseFirstDevice(); m_listPriority.clear();
m_listPriority.push_back(BIOTYPE_FACE);
m_listPriority.push_back(BIOTYPE_FINGERPRINT);
m_listPriority.push_back(BIOTYPE_IRIS);
m_listPriority.push_back(BIOTYPE_VOICEPRINT);
m_listPriority.push_back(BIOTYPE_FINGERVEIN);
m_listPriority.push_back(REMOTE_QRCODE_TYPE);
}
void BioDevices::setUId(int nUId)
{
m_nUId = nUId;
getDevicesList();
} }
void BioDevices::connectToService() void BioDevices::connectToService()
@ -92,6 +104,31 @@ void BioDevices::onUSBDeviceHotPlug(int deviceId, int action, int devNumNow)
} }
} }
bool BioDevices::GetBioAuthEnable(uid_t uid)
{
if (m_uniAuthService && m_uniAuthService->isActivatable()) {
struct passwd *pwd = getpwuid(uid);
if (pwd) {
return m_uniAuthService->getBioAuthStatus(pwd->pw_name, ENABLETYPE_BIO);
} else {
return false;
}
} else {
QString configPath = "/etc/biometric-auth/ukui-biometric.conf";
QSettings settings(configPath, QSettings::IniFormat);
qDebug() << "configure path: " << settings.fileName();
if(settings.allKeys().contains("EnableAuth")){
return settings.value("EnableAuth").toBool();
}else{
QSettings sysSettings(GET_STR(CONFIG_FILE), QSettings::IniFormat);
if(sysSettings.contains("EnableAuth"))
return sysSettings.value("EnableAuth").toBool();
else
return true;
}
}
}
/** /**
* *
@ -237,30 +274,45 @@ void BioDevices::setIsShowHotPlug(bool isShow)
bool BioDevices::getUseFirstDevice() bool BioDevices::getUseFirstDevice()
{ {
if (m_uniAuthService && m_uniAuthService->isActivatable()) {
return m_uniAuthService->getUseFirstDevice();
} else {
QSettings settings("/etc/biometric-auth/ukui-biometric.conf", QSettings::IniFormat); QSettings settings("/etc/biometric-auth/ukui-biometric.conf", QSettings::IniFormat);
return settings.value("UseFirstDevice").toBool(); return settings.value("UseFirstDevice").toBool();
} }
}
bool BioDevices::GetHiddenSwitchButton() bool BioDevices::GetHiddenSwitchButton()
{ {
if (m_uniAuthService && m_uniAuthService->isActivatable()) {
return m_uniAuthService->getHiddenSwitchButton();
} else {
QSettings sysSettings("/etc/biometric-auth/ukui-biometric.conf", QSettings::IniFormat); QSettings sysSettings("/etc/biometric-auth/ukui-biometric.conf", QSettings::IniFormat);
if(sysSettings.contains("HiddenSwitchButton")) if(sysSettings.contains("HiddenSwitchButton"))
return sysSettings.value("HiddenSwitchButton").toBool(); return sysSettings.value("HiddenSwitchButton").toBool();
else else
return false; return false;
} }
}
int BioDevices::getFailedTimes() int BioDevices::getFailedTimes()
{ {
if (m_uniAuthService && m_uniAuthService->isActivatable()) {
return m_uniAuthService->getMaxFailedTimes();
} else {
QSettings sysSettings("/etc/biometric-auth/ukui-biometric.conf", QSettings::IniFormat); QSettings sysSettings("/etc/biometric-auth/ukui-biometric.conf", QSettings::IniFormat);
if(sysSettings.contains("MaxFailedTimes")) if(sysSettings.contains("MaxFailedTimes"))
return sysSettings.value("MaxFailedTimes").toInt(); return sysSettings.value("MaxFailedTimes").toInt();
else else
return 3; return 3;
} }
}
bool BioDevices::GetQRCodeEnable() bool BioDevices::GetQRCodeEnable()
{ {
if (m_uniAuthService && m_uniAuthService->isActivatable()) {
return m_uniAuthService->getQRCodeEnable();
} else {
bool isEnable = false; bool isEnable = false;
QSettings sysSettings("/etc/biometric-auth/ukui-biometric.conf", QSettings::IniFormat); QSettings sysSettings("/etc/biometric-auth/ukui-biometric.conf", QSettings::IniFormat);
sysSettings.beginGroup("Functions"); sysSettings.beginGroup("Functions");
@ -270,22 +322,110 @@ bool BioDevices::GetQRCodeEnable()
sysSettings.endGroup(); sysSettings.endGroup();
return isEnable; return isEnable;
} }
}
/**
* ukui-greeter 1
* ukui-screensaver 1<<1
* ukui-polkit 1<<2
* sudo 1<<3
* su 1<<4
* login 1<<5
**/
bool BioDevices::GetBioAuthEnable() bool BioDevices::GetBioAuthEnable()
{ {
if (m_uniAuthService && m_uniAuthService->isActivatable()) {
bool isEnable = false; bool isEnable = false;
struct passwd *pwd = getpwuid(m_nUId);
if (pwd) {
isEnable = m_uniAuthService->getBioAuthStatus(pwd->pw_name, ENABLETYPE_BIO);
}
if (isEnable && !isShowHotPlug) {
if(qAppName() == "polkit-ukui-authentication-agent-1") //获取polkit开关是否打开
isEnable = m_uniAuthService->getBioAuthStatus(pwd->pw_name, ENABLETYPE_POLKIT);
if(qAppName() == "bioauth"){ //获取父进程名称为sudosu或者login
int ppid = getppid(); //获取父进程pid
QString filename = "/proc/" + QString::number(ppid) + "/cmdline";
QFile file(filename);
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
qDebug()<<"Can't open the file!"<<endl;
}
QByteArray text = file.readAll();
file.close();
if(text.contains("sudo")){
isEnable = m_uniAuthService->getBioAuthStatus(pwd->pw_name, ENABLETYPE_SUDO);
}else if(text.contains("su")){
isEnable = m_uniAuthService->getBioAuthStatus(pwd->pw_name, ENABLETYPE_SU);
}else if(text.contains("login")){
isEnable = m_uniAuthService->getBioAuthStatus(pwd->pw_name, ENABLETYPE_LOGIN);
}
}
}
return isEnable;
} else {
bool isEnable = false;
int isEnableApp = 0;
QSettings sysSettings("/etc/biometric-auth/ukui-biometric.conf", QSettings::IniFormat); QSettings sysSettings("/etc/biometric-auth/ukui-biometric.conf", QSettings::IniFormat);
if (sysSettings.allKeys().contains("EnableAuth")) { if (sysSettings.allKeys().contains("EnableAuth")) {
isEnable = sysSettings.value("EnableAuth").toBool(); isEnable = sysSettings.value("EnableAuth").toBool();
} }
if (isEnable && sysSettings.allKeys().contains("EnableAuthApp")) {
isEnableApp = sysSettings.value("EnableAuthApp").toInt();
if(qAppName() == "polkit-ukui-authentication-agent-1") //获取polkit开关是否打开
isEnable = isEnableApp & (1<<2);
if(qAppName() == "bioauth"){ //获取父进程名称为sudosu或者login
int ppid = getppid(); //获取父进程pid
QString filename = "/proc/" + QString::number(ppid) + "/cmdline";
QFile file(filename);
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
qDebug()<<"Can't open the file!"<<endl;
}
QByteArray text = file.readAll();
file.close();
if(text.contains("sudo")){
isEnable = isEnableApp & (1<<3);
}else if(text.contains("su")){
isEnable = isEnableApp & (1<<4);
}else if(text.contains("login")){
isEnable = isEnableApp & (1<<5);
}
}
}
return isEnable; return isEnable;
} }
}
DeviceInfoPtr BioDevices::getDefaultDevice(uid_t uid) DeviceInfoPtr BioDevices::getDefaultDevice(uid_t uid)
{ {
if(deviceInfos.size() <= 0) if(deviceInfos.size() <= 0)
return nullptr; return nullptr;
if (m_uniAuthService && m_uniAuthService->isActivatable()) {
QString defaultDeviceName = "";
struct passwd *pwdInfo = getpwuid(uid);
DeviceInfoPtr ptrDevInfo = nullptr;
if (pwdInfo) {
for (auto bioType : m_listPriority) {
QString strDeviceName = m_uniAuthService->getDefaultDevice(pwdInfo->pw_name, bioType);
if(!strDeviceName.isEmpty()) {
ptrDevInfo = findDevice(strDeviceName);
if (ptrDevInfo) {
if (GetUserDevFeatureCount(uid,ptrDevInfo->device_id) > 0) {
defaultDeviceName = strDeviceName;
break;
}
}
}
}
}
if(defaultDeviceName.isEmpty()){
return nullptr;
}
return ptrDevInfo;
} else {
QString defaultDeviceName; QString defaultDeviceName;
struct passwd *pwd = getpwuid(uid); struct passwd *pwd = getpwuid(uid);
@ -310,10 +450,6 @@ DeviceInfoPtr BioDevices::getDefaultDevice(uid_t uid)
qDebug() << "default device: " << defaultDeviceName; qDebug() << "default device: " << defaultDeviceName;
// 终端不默认使用第一个设备 // 终端不默认使用第一个设备
if(defaultDeviceName.isEmpty()){ if(defaultDeviceName.isEmpty()){
// if(!useFirstDevice)
// return nullptr;
// else
// return getFirstDevice(uid);
return nullptr; return nullptr;
} }
bool defValid = false; bool defValid = false;
@ -325,15 +461,48 @@ DeviceInfoPtr BioDevices::getDefaultDevice(uid_t uid)
} }
if (!defValid) { if (!defValid) {
// if(!useFirstDevice)
// ptrDevInfo = nullptr;
// else
// ptrDevInfo = getFirstDevice(uid);
ptrDevInfo = nullptr; ptrDevInfo = nullptr;
} }
return ptrDevInfo; return ptrDevInfo;
} }
}
QStringList BioDevices::getAllDefDevices()
{
QStringList listDefDevices;
if (m_uniAuthService && m_uniAuthService->isActivatable()) {
struct passwd *pwdInfo = getpwuid(m_nUId);
if (pwdInfo) {
listDefDevices = m_uniAuthService->getAllDefaultDevice(pwdInfo->pw_name);
}
} else {
QString defaultDeviceName;
struct passwd *pwd = getpwuid(m_nUId);
QString userConfigFile = QString(pwd->pw_dir) + "/.biometric_auth/ukui_biometric.conf";
QSettings userConfig(userConfigFile, QSettings::IniFormat);
qDebug() << userConfig.fileName();
defaultDeviceName = userConfig.value(DEFAULT_DEVICE).toString();
qDebug() << defaultDeviceName;
if(defaultDeviceName.isEmpty() || !findDevice(defaultDeviceName)) {
QSettings sysConfig(GET_STR(CONFIG_FILE), QSettings::IniFormat);
defaultDeviceName = sysConfig.value(DEFAULT_DEVICE).toString();
}
if(defaultDeviceName.isEmpty() || !findDevice(defaultDeviceName)){
QString userConfigFile = QString(pwd->pw_dir) + "/.biometric_auth/ukui_biometric.conf";
QSettings userConfig(userConfigFile, QSettings::IniFormat);
defaultDeviceName = userConfig.value(DEFAULT_DEVICE).toString();
}
qDebug() << "default device: " << defaultDeviceName;
if(!defaultDeviceName.isEmpty()){
listDefDevices.push_back(defaultDeviceName);
}
}
return listDefDevices;
}
int BioDevices::GetLastDevice(const QString &userName) int BioDevices::GetLastDevice(const QString &userName)
{ {

View File

@ -27,6 +27,7 @@ LoginOptionsWidget::LoginOptionsWidget(QWidget *parent)
: QWidget(parent) : QWidget(parent)
, m_biomericProxy(new BioAuth(this)) , m_biomericProxy(new BioAuth(this))
, m_bioDevices(new BioDevices()) , m_bioDevices(new BioDevices())
, w_timer(nullptr)
{ {
initUI(); initUI();
initConnections(); initConnections();
@ -73,8 +74,17 @@ void LoginOptionsWidget::initUI()
m_labelFace->setObjectName("faceLabel"); m_labelFace->setObjectName("faceLabel");
m_labelFace->setAlignment(Qt::AlignCenter); m_labelFace->setAlignment(Qt::AlignCenter);
m_labelFace->setFixedSize(154,154); m_labelFace->setFixedSize(154,154);
QImage img; QHBoxLayout *layoutFace = new QHBoxLayout();
setFaceImg(img); layoutFace->setContentsMargins(0,0,0,0);
layoutFace->setAlignment(Qt::AlignCenter);
m_labelFace->setLayout(layoutFace);
m_labelFaceLoad = new QLabel();
m_labelFaceLoad->setAlignment(Qt::AlignCenter);
m_labelFaceLoad->setFixedSize(142, 142);
m_labelFaceLoad->setStyleSheet(QString("QLabel{background-color: rgba(230,230,230,0.39); border-radius: %1px; border: 8px solid white;}").arg(71));
layoutFace->addWidget(m_labelFaceLoad, 0, Qt::AlignVCenter);
// QImage img;
// setFaceImg(img);
m_labelFace->hide(); m_labelFace->hide();
// 二维码窗口 // 二维码窗口
m_labelQRCode = new QLabel(m_widgetImage); m_labelQRCode = new QLabel(m_widgetImage);
@ -85,11 +95,11 @@ void LoginOptionsWidget::initUI()
m_layoutMain->addLayout(m_layoutImage); m_layoutMain->addLayout(m_layoutImage);
QVBoxLayout *layoutQRCode = new QVBoxLayout(); QVBoxLayout *layoutQRCode = new QVBoxLayout();
layoutQRCode->setAlignment(Qt::AlignCenter); layoutQRCode->setAlignment(Qt::AlignCenter);
layoutQRCode->setSpacing(10); layoutQRCode->setSpacing(5);
m_labelQRCode->setLayout(layoutQRCode); m_labelQRCode->setLayout(layoutQRCode);
m_labelQRCodeTip = new QLabel(); m_labelQRCodeTip = new QLabel();
m_labelQRCodeTip->setFixedSize(22,22); m_labelQRCodeTip->setFixedSize(22,22);
m_labelQRCodeTip->setPixmap(QIcon::fromTheme("ukui-dialog-warning").pixmap(QSize(22,22))); m_labelQRCodeTip->setPixmap(QIcon::fromTheme("dialog-warning").pixmap(QSize(22,22)));
layoutQRCode->addWidget(m_labelQRCodeTip, 0, Qt::AlignHCenter); layoutQRCode->addWidget(m_labelQRCodeTip, 0, Qt::AlignHCenter);
m_labelQRCodeMsg = new QLabel(); m_labelQRCodeMsg = new QLabel();
m_labelQRCodeMsg->setFixedHeight(24); m_labelQRCodeMsg->setFixedHeight(24);
@ -117,7 +127,7 @@ void LoginOptionsWidget::initConnections()
if (m_bioDevices) { if (m_bioDevices) {
connect(m_bioDevices, &BioDevices::deviceCountChanged, connect(m_bioDevices, &BioDevices::deviceCountChanged,
this, &LoginOptionsWidget::onUSBDeviceCountChange); this, &LoginOptionsWidget::onUSBDeviceCountChange);
readDevicesInfo(); //readDevicesInfo();
} }
connect(m_btnGroup, SIGNAL(buttonClicked(int)), this, SLOT(onOptionSelected(int))); connect(m_btnGroup, SIGNAL(buttonClicked(int)), this, SLOT(onOptionSelected(int)));
} }
@ -293,6 +303,9 @@ void LoginOptionsWidget::setUser(int uid)
} }
m_uid = uid; m_uid = uid;
if (bNeedUpdateDevInfo) { if (bNeedUpdateDevInfo) {
if (m_bioDevices) {
m_bioDevices->setUId(m_uid);
}
readDevicesInfo(); readDevicesInfo();
} }
} }
@ -303,6 +316,7 @@ void LoginOptionsWidget::readDevicesInfo()
bool isAuthEnable = m_bioDevices->GetBioAuthEnable(); bool isAuthEnable = m_bioDevices->GetBioAuthEnable();
bool isQRCodeEnable = m_bioDevices->GetQRCodeEnable(); bool isQRCodeEnable = m_bioDevices->GetQRCodeEnable();
DeviceList deviceList = m_bioDevices->GetDevList(); DeviceList deviceList = m_bioDevices->GetDevList();
QStringList listDefDevices = m_bioDevices->getAllDefDevices();
for(auto pDeviceInfo : deviceList) for(auto pDeviceInfo : deviceList)
{ {
int nDevFeatureCount = 0; int nDevFeatureCount = 0;
@ -323,9 +337,12 @@ void LoginOptionsWidget::readDevicesInfo()
continue; continue;
int nDevType = LOGINOPT_TYPE_OTHERS; int nDevType = LOGINOPT_TYPE_OTHERS;
nDevType = convertDeviceType(pDeviceInfo->biotype); nDevType = convertDeviceType(pDeviceInfo->biotype);
if (listDefDevices.contains(pDeviceInfo->device_shortname) &&
!m_mapDevices.contains(nDevType)) {
m_mapDevices[nDevType].push_back(pDeviceInfo); m_mapDevices[nDevType].push_back(pDeviceInfo);
} }
} }
}
updateOptionButtons(); updateOptionButtons();
updateUIStatus(false); updateUIStatus(false);
//Q_EMIT notifyOptionsChange(m_mapDevices.size()); //Q_EMIT notifyOptionsChange(m_mapDevices.size());
@ -333,7 +350,7 @@ void LoginOptionsWidget::readDevicesInfo()
void LoginOptionsWidget::startAuth(DeviceInfoPtr device, int uid) void LoginOptionsWidget::startAuth(DeviceInfoPtr device, int uid)
{ {
if(!m_biomericProxy) if(!device || !m_biomericProxy || is_Lock)
{ {
qWarning() << "BiometricProxy doesn't exist."; qWarning() << "BiometricProxy doesn't exist.";
return; return;
@ -363,7 +380,24 @@ void LoginOptionsWidget::startAuth_()
m_isInAuth = true; m_isInAuth = true;
m_dupFD = -1; m_dupFD = -1;
if(!w_timer)
{
w_timer = new QTimer(this);
w_timer->setInterval(150);
connect(w_timer, &QTimer::timeout, this, &LoginOptionsWidget::updatePixmap);
}
m_waitingPixmap = QIcon::fromTheme("ukui-loading-0-symbolic").pixmap(24, 24);
if(m_curLoginOptType == LOGINOPT_TYPE_QRCODE) {
m_labelQRCodeTip->setPixmap(m_waitingPixmap);
m_labelQRCodeTip->show();
m_labelQRCodeMsg->hide();
} else if(m_curLoginOptType == LOGINOPT_TYPE_FACE) {
m_labelFace->setStyleSheet(QString("border-radius: %1px; border:0px solid white;background-color: rgba(230,230,230,0.39);").arg(77));
m_labelFace->setPixmap(QPixmap(""));
m_labelFaceLoad->setPixmap(m_waitingPixmap);
m_labelFaceLoad->show();
}
w_timer->start();
m_biomericProxy->startAuth(m_uid, m_curDevInfo); m_biomericProxy->startAuth(m_uid, m_curDevInfo);
} }
@ -386,6 +420,18 @@ void LoginOptionsWidget::stopAuth()
setFaceImg(img); setFaceImg(img);
} }
void LoginOptionsWidget::updatePixmap()
{
QMatrix matrix;
matrix.rotate(90.0);
m_waitingPixmap = m_waitingPixmap.transformed(matrix, Qt::FastTransformation);
if(m_curLoginOptType == LOGINOPT_TYPE_QRCODE)
m_labelQRCodeTip->setPixmap(m_waitingPixmap);
else if(m_curLoginOptType == LOGINOPT_TYPE_FACE) {
m_labelFaceLoad->setPixmap(m_waitingPixmap);
}
}
void LoginOptionsWidget::onIdentifyComplete(int uid, bool ret, int retErrNo) void LoginOptionsWidget::onIdentifyComplete(int uid, bool ret, int retErrNo)
{ {
if(m_isStopped == true) if(m_isStopped == true)
@ -414,6 +460,10 @@ void LoginOptionsWidget::onIdentifyComplete(int uid, bool ret, int retErrNo)
if(ret.result == 0 && (ret.opsStatus == 404 || ret.opsStatus == 304 if(ret.result == 0 && (ret.opsStatus == 404 || ret.opsStatus == 304
|| ret.opsStatus == 8)) { // 304认证超时 8网络异常 || ret.opsStatus == 8)) { // 304认证超时 8网络异常
Q_EMIT authComplete(uid, false, 1); Q_EMIT authComplete(uid, false, 1);
} else if (ret.opsStatus == OPS_IDENTIFY_STOP_BY_USER || ret.opsStatus == OPS_VERIFY_STOP_BY_USER) {
Q_EMIT authComplete(uid, false, -2); // 主动停止,直接重试
} else if (ret.opsStatus == OPS_OPEN_FAIL || ret.opsStatus == OPS_OPEN_ERROR) { // 无法打开设备(设备是坏的/被占用),直接禁用
Q_EMIT authComplete(uid, false, 5);
} else { } else {
Q_EMIT authComplete(uid, false, 2); Q_EMIT authComplete(uid, false, 2);
} }
@ -518,6 +568,7 @@ void LoginOptionsWidget::onFrameWritten(int drvid)
m_labelQRCode->setStyleSheet(QString("border-radius: %1px; border:0px solid white;background-color: rgba(255,255,255,100%);").arg(6)); m_labelQRCode->setStyleSheet(QString("border-radius: %1px; border:0px solid white;background-color: rgba(255,255,255,100%);").arg(6));
setQRCode(srcQImage); setQRCode(srcQImage);
m_labelQRCode->show(); m_labelQRCode->show();
m_labelQRCodeTip->hide();
m_labelFace->hide(); m_labelFace->hide();
} else { } else {
m_labelFace->hide(); m_labelFace->hide();
@ -527,6 +578,10 @@ void LoginOptionsWidget::onFrameWritten(int drvid)
m_labelFace->hide(); m_labelFace->hide();
m_labelQRCode->hide(); m_labelQRCode->hide();
} }
if(w_timer && w_timer->isActive())
{
w_timer->stop();
}
Q_EMIT updateImage(srcQImage); Q_EMIT updateImage(srcQImage);
} }
@ -544,11 +599,17 @@ void LoginOptionsWidget::setQRCodeMsg(QString strMsg)
{ {
if (strMsg.isEmpty()) { if (strMsg.isEmpty()) {
m_labelQRCodeMsg->hide(); m_labelQRCodeMsg->hide();
m_labelQRCodeTip->hide(); //m_labelQRCodeTip->hide();
} else { } else {
//一开始认证时就没有网,直接停止加载状态
if(w_timer && w_timer->isActive())
{
w_timer->stop();
}
m_labelQRCodeMsg->setText(strMsg); m_labelQRCodeMsg->setText(strMsg);
m_labelQRCodeMsg->show(); m_labelQRCodeMsg->show();
m_labelQRCodeTip->show(); m_labelQRCodeTip->show();
m_labelQRCodeTip->setPixmap(QIcon::fromTheme("dialog-warning").pixmap(QSize(22,22)));
} }
} }
@ -563,15 +624,22 @@ void LoginOptionsWidget::setFaceImg(QImage& imgFace, int nStatus)
switch(nStatus) { switch(nStatus) {
case 1: case 1:
faceImage = loadSvg(QString("%1/images/ukui-loginopt-lose.svg").arg(GET_STR(UKUI_BIOMETRIC)),"black",48); faceImage = loadSvg(QString("%1/images/ukui-loginopt-lose.svg").arg(GET_STR(UKUI_BIOMETRIC)),"black",48);
m_labelFace->setStyleSheet(QString("border-radius: %1px; border:0px solid white;background-color: rgba(230,230,230,40%);").arg(77));
break;
case 2:
faceImage = loadSvg(QString("%1/images/ukui-loginopt-smile.svg").arg(GET_STR(UKUI_BIOMETRIC)),"gray",48);
m_labelFace->setStyleSheet(QString("border-radius: %1px; border:0px solid white;background-color: rgba(230,230,230,100%);").arg(77));
break; break;
default: default:
faceImage = loadSvg(QString("%1/images/ukui-loginopt-smile.svg").arg(GET_STR(UKUI_BIOMETRIC)),"black",48); faceImage = loadSvg(QString("%1/images/ukui-loginopt-smile.svg").arg(GET_STR(UKUI_BIOMETRIC)),"black",48);
m_labelFace->setStyleSheet(QString("border-radius: %1px; border:0px solid white;background-color: rgba(230,230,230,40%);").arg(77));
break; break;
} }
} }
m_labelFace->setAlignment(Qt::AlignCenter); m_labelFace->setAlignment(Qt::AlignCenter);
m_labelFace->setPixmap(faceImage); m_labelFace->setPixmap(faceImage);
m_labelFaceLoad->hide();
} }
void LoginOptionsWidget::onStatusChanged(int drvid, const QString &message) void LoginOptionsWidget::onStatusChanged(int drvid, const QString &message)
@ -646,24 +714,10 @@ DeviceInfoPtr LoginOptionsWidget::findDeviceByName(const QString &name)
QString LoginOptionsWidget::GetDefaultDevice(uid_t uid) QString LoginOptionsWidget::GetDefaultDevice(uid_t uid)
{ {
QString defaultDeviceName; QString defaultDeviceName = "";
DeviceInfoPtr pDeviceInfo = m_bioDevices->getDefaultDevice(uid);
struct passwd *pwd = getpwuid(uid); if (pDeviceInfo) {
QString userConfigFile = QString(pwd->pw_dir) + "/.biometric_auth/ukui_biometric.conf"; defaultDeviceName = pDeviceInfo->device_shortname;
QSettings userConfig(userConfigFile, QSettings::IniFormat);
qDebug() << userConfig.fileName();
defaultDeviceName = userConfig.value(DEFAULT_DEVICE).toString();
qDebug() << defaultDeviceName;
if(defaultDeviceName.isEmpty() || !findDeviceByName(defaultDeviceName)) {
QSettings sysConfig(GET_STR(CONFIG_FILE), QSettings::IniFormat);
defaultDeviceName = sysConfig.value(DEFAULT_DEVICE).toString();
}
if(defaultDeviceName.isEmpty() || !findDeviceByName(defaultDeviceName)){
QString userConfigFile = QString(pwd->pw_dir) + "/.biometric_auth/ukui_biometric.conf";
QSettings userConfig(userConfigFile, QSettings::IniFormat);
defaultDeviceName = userConfig.value(DEFAULT_DEVICE).toString();
} }
qDebug() << "default device: " << defaultDeviceName; qDebug() << "default device: " << defaultDeviceName;
@ -691,13 +745,6 @@ void LoginOptionsWidget::onUSBDeviceCountChange(int newNum)
updateUIStatus(false); updateUIStatus(false);
} }
bool LoginOptionsWidget::getAuthDouble()
{
QSettings settings("/etc/biometric-auth/ukui-biometric.conf", QSettings::IniFormat);
bool distribId = settings.value("DoubleAuth").toBool();
return distribId;
}
void LoginOptionsWidget::updateUIStatus(bool update) void LoginOptionsWidget::updateUIStatus(bool update)
{ {
if (m_mapOptBtns.contains(-1)) { if (m_mapOptBtns.contains(-1)) {
@ -810,6 +857,17 @@ bool LoginOptionsWidget::isDeviceDisable(int nDevId)
return false; return false;
} }
void LoginOptionsWidget::lockStatusChanged(bool locked)
{
if(locked){
is_Lock = true;
stopAuth();
} else {
is_Lock = false;
readDevicesInfo();
}
}
QPixmap LoginOptionsWidget::loadSvg(QString path, QString color, int size) QPixmap LoginOptionsWidget::loadSvg(QString path, QString color, int size)
{ {
int origSize = size; int origSize = size;

View File

@ -0,0 +1,251 @@
/*
* Copyright (C) 2022 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
**/
#include "uniauthservice.h"
#include <QDebug>
#include <pwd.h>
#define UNIAUTH_DBUS_SERVICE "org.ukui.UniauthBackend"
#define UNIAUTH_DBUS_PATH "/org/ukui/UniauthBackend"
#define UNIAUTH_DBUS_INTERFACE "org.ukui.UniauthBackend"
#define FD_DBUS_SERVICE "org.freedesktop.DBus"
#define FD_DBUS_PATH "/org/freedesktop/DBus"
#define FD_DBUS_INTERFACE "org.freedesktop.DBus"
UniAuthService::UniAuthService(QObject *parent)
: QDBusAbstractInterface(UNIAUTH_DBUS_SERVICE,
UNIAUTH_DBUS_PATH,
UNIAUTH_DBUS_INTERFACE,
QDBusConnection::systemBus(),
parent)
, m_isActivatable(false)
{
setTimeout(2147483647);
QDBusInterface *dbusService = new QDBusInterface(FD_DBUS_SERVICE,
FD_DBUS_PATH,
FD_DBUS_INTERFACE,
QDBusConnection::systemBus());
if (dbusService) {
QDBusReply<QStringList> result = dbusService->call(QStringLiteral("ListActivatableNames"));
if(!result.isValid()) {
qWarning() << "ListActivatableNames error:" << result.error().message();
} else {
QStringList listNames = result.value();
if (listNames.contains(UNIAUTH_DBUS_INTERFACE)) {
m_isActivatable = true;
}
}
}
}
// 设置默认设备
void UniAuthService::setDefaultDevice(int bioDevType, QString deviceName)
{
qDebug() << " bioType : " << bioDevType << "deviceName : " << deviceName;
QDBusMessage result = call(QStringLiteral("setDefaultDevice"), bioDevType, deviceName);
if(result.type() == QDBusMessage::ErrorMessage)
{
qWarning() << "setDefaultDevice error:" << result.errorMessage();
return ;
}
return ;
}
// 获取默认设备
QString UniAuthService::getDefaultDevice(QString userName, int bioDevType)
{
QDBusMessage result = call(QStringLiteral("getDefaultDevice"), userName, bioDevType);
if(result.type() == QDBusMessage::ErrorMessage)
{
qWarning() << "getDefaultDevice error:" << result.errorMessage();
return "";
}
QList<QVariant> varResult = result.arguments();
if (varResult.size() > 0) {
QString strDefDevice = varResult.takeFirst().toString();
return strDefDevice;
} else {
return "";
}
}
// 获取所有默认设备
QStringList UniAuthService::getAllDefaultDevice(QString userName)
{
QStringList listDefDevices;
QDBusReply<QStringList> result = call(QStringLiteral("getAllDefaultDevice"), userName);
if(!result.isValid()) {
qWarning() << "getAllDefaultDevice error:" << result.error().message();
} else {
listDefDevices = result.value();
}
return listDefDevices;
}
//生物特征开关接口
bool UniAuthService::getBioAuthStatus(QString userName, int bioAuthType)
{
QDBusMessage bioResult = call(QStringLiteral("getBioAuthStatus"), userName, bioAuthType);
if(bioResult.type() == QDBusMessage::ErrorMessage)
{
qWarning() << "getBioStatus error:" << bioResult.errorMessage();
return false;
}
QList<QVariant> varResult = bioResult.arguments();
if (varResult.size() > 0) {
return varResult.takeFirst().toBool();
} else {
return false;
}
}
void UniAuthService::setBioAuthStatus(int bioAuthType, bool status)
{
qDebug() << "setBioAuthStatus bioAuthType : " << bioAuthType << "status : " << status;
QDBusMessage result = call(QStringLiteral("setBioAuthStatus"), bioAuthType, status);
if(result.type() == QDBusMessage::ErrorMessage)
{
qWarning() << "setBioAuthStatus error:" << result.errorMessage();
return ;
}
return ;
}
// 获取最大失败次数
int UniAuthService::getMaxFailedTimes()
{
QDBusMessage result = call(QStringLiteral("getMaxFailedTimes"));
if(result.type() == QDBusMessage::ErrorMessage)
{
qWarning() << "getMaxFailedTimes error:" << result.errorMessage();
return false;
}
QList<QVariant> varResult = result.arguments();
if (varResult.size() > 0) {
return varResult.takeFirst().toInt();
} else {
return 3;
}
}
// 获取是否使能微信扫码登录
bool UniAuthService::getQRCodeEnable()
{
QDBusMessage result = call(QStringLiteral("getQRCodeEnable"));
if(result.type() == QDBusMessage::ErrorMessage)
{
qWarning() << "getQRCodeEnable error:" << result.errorMessage();
return false;
}
QList<QVariant> varResult = result.arguments();
if (varResult.size() > 0) {
return varResult.takeFirst().toBool();
} else {
return false;
}
}
// 获取是否双认证
bool UniAuthService::getDoubleAuth()
{
QDBusMessage result = call(QStringLiteral("getDoubleAuth"));
if(result.type() == QDBusMessage::ErrorMessage)
{
qWarning() << "getDoubleAuth error:" << result.errorMessage();
return false;
}
QList<QVariant> varResult = result.arguments();
if (varResult.size() > 0) {
return varResult.takeFirst().toBool();
} else {
return false;
}
}
// 获取用户绑定
bool UniAuthService::getUserBind()
{
QDBusMessage result = call(QStringLiteral("getUserBind"));
if(result.type() == QDBusMessage::ErrorMessage)
{
qWarning() << "getUserBind error:" << result.errorMessage();
return false;
}
QList<QVariant> varResult = result.arguments();
if (varResult.size() > 0) {
return varResult.takeFirst().toBool();
} else {
return false;
}
}
// 获取是否在控制面板显示
bool UniAuthService::getIsShownInControlCenter()
{
QDBusMessage result = call(QStringLiteral("getIsShownInControlCenter"));
if(result.type() == QDBusMessage::ErrorMessage)
{
qWarning() << "getIsShownInControlCenter error:" << result.errorMessage();
return false;
}
QList<QVariant> varResult = result.arguments();
if (varResult.size() > 0) {
return varResult.takeFirst().toBool();
} else {
return false;
}
}
// 获取是否使用第一个设备
bool UniAuthService::getUseFirstDevice()
{
QDBusMessage result = call(QStringLiteral("getUseFirstDevice"));
if(result.type() == QDBusMessage::ErrorMessage)
{
qWarning() << "getUseFirstDevice error:" << result.errorMessage();
return false;
}
QList<QVariant> varResult = result.arguments();
if (varResult.size() > 0) {
return varResult.takeFirst().toBool();
} else {
return false;
}
}
// 获取是否隐藏切换按钮
bool UniAuthService::getHiddenSwitchButton()
{
QDBusMessage result = call(QStringLiteral("getHiddenSwitchButton"));
if(result.type() == QDBusMessage::ErrorMessage)
{
qWarning() << "getHiddenSwitchButton error:" << result.errorMessage();
return false;
}
QList<QVariant> varResult = result.arguments();
if (varResult.size() > 0) {
return varResult.takeFirst().toBool();
} else {
return false;
}
}
bool UniAuthService::isActivatable()
{
return m_isActivatable;
}

579
debian/changelog vendored Normal file
View File

@ -0,0 +1,579 @@
ukui-biometric-auth (3.20.0.11) v101; urgency=medium
* BUG号143415 【安全套件】卫士通Ukey绑定后授权提示信息乱码
139665 【人脸】【登录】摄像头运行时锁屏,人脸认证快速认证失败五次
* 需求号:无
* 其他修改说明:无
* commit id059adfb
-- Yang Min <yangmin@kylinos.cn> Wed, 12 Oct 2022 14:02:41 +0800
ukui-biometric-auth (3.20.0.10) v101; urgency=medium
* BUG号140637 【2203自适应升级2209】【生物特征工具】生物设备权限开启后生物识别未勾选但仍可以使用生物识别。
140617 【2203自适应升级2209】【冒烟2级】【生物特征工具】生物设备权限开启后生物识别默认未勾选
* 需求号:无
* 其他修改说明:无
* commit id44d276f
-- Yang Min <yangmin@kylinos.cn> Thu, 29 Sep 2022 20:58:32 +0800
ukui-biometric-auth (3.20.0.9) v101; urgency=medium
* BUG号140646 【藏文】【生物特征工具】【需求 9380】启动指纹驱动授权弹窗添加指纹授权弹窗空密码确认提示乱码
141830 【PTOF】【提权】输入空密码时提示显示为乱码
* 需求号:无
* 其他修改说明:无
* commit id9fa8ae8
-- Yang Min <yangmin@kylinos.cn> Fri, 23 Sep 2022 18:15:06 +0800
ukui-biometric-auth (3.20.0.8) v101; urgency=medium
* BUG号139865 【藏文】生物特征录入指纹完成界面未完全汉化
136746 【生物特诊管理工具】【藏文】生物特征管理工具关于、帮助、授权弹框等界面未完全翻译成藏文
* 需求号:无
* 其他修改说明:无
* commit id3a39662
-- Yang Min <yangmin@kylinos.cn> Sat, 17 Sep 2022 10:46:44 +0800
ukui-biometric-auth (3.20.0.7) v101; urgency=medium
* BUG号136689 【锁屏】锁屏界面长按ctrl+shift+esc 可直接进入系统
* 需求号:无
* 其他修改说明:无
* commit id653d02f
-- Yang Min <yangmin@kylinos.cn> Wed, 14 Sep 2022 15:33:27 +0800
ukui-biometric-auth (3.20.0.6) v101; urgency=medium
* BUG号136306 【分区编辑器】藏文版本下提权窗口输入错误密码会闪退
* 需求号:无
* 其他修改说明:无
* commit id:bb31691
-- Yang Min <yangmin@kylinos.cn> Wed, 24 Aug 2022 19:12:28 +0800
ukui-biometric-auth (3.20.0.5) v101; urgency=medium
* BUG号136128 【锁屏】同时连点ESC与Enter键和可跳过锁屏界面进入桌面
136689 【锁屏】锁屏界面长按ctrl+shift+esc 可直接进入系统
* 需求号:无
* 其他修改说明:无
* commit id87d3b01
-- Yang Min <yangmin@kylinos.cn> Mon, 22 Aug 2022 18:51:42 +0800
ukui-biometric-auth (3.20.0.4) v101; urgency=medium
* BUG号130082 【生物特征管理工具】连续关闭生物设备指纹驱动后,提示更改设备状态失败,切换侧边栏导航提示服务已关闭,关闭应用再次打开,服务未启动
128098 【U盘启动器】授权窗口切换另一个管理员用户错误密码提示未清除
133204 【生物识别认证】【x100】【通有】授权窗口处拔掉摄像头授权窗口直接退出
* 需求号:无
* 其他修改说明:无
* commit id563f201
-- Yang Min <yangmin@kylinos.cn> Fri, 12 Aug 2022 18:06:14 +0800
ukui-biometric-auth (3.20.0.3) v101; urgency=medium
* BUG号129220 【账户保护】多次输错登录密码不会提示账户锁定
129153 【安全中心】默认账户锁定策略不生效
* 需求号:无
* 其他修改说明:无
* commit id804cfde
-- Yang Min <yangmin@kylinos.cn> Mon, 01 Aug 2022 10:49:14 +0800
ukui-biometric-auth (3.20.0.2) v101; urgency=medium
* BUG号128655 【设计】授权验证提示失败和验证状态与设计期望不符
128663 【设计】提权界面在等待后断反馈时,无提示
125394 【登录选项】绑定微信后,鼠标移入分区编辑器授权窗口提示语,提示语显示不完整
* 需求号:无
* 其他修改说明替换调用libukui-common接口为libkysdk-sysinfo接口
* commit id:6562cbd
-- Yang Min <yangmin@kylinos.cn> Fri, 15 Jul 2022 20:20:21 +0800
ukui-biometric-auth (3.20.0.1) v101; urgency=medium
* BUG号126383 【控制面板】【时间和日期】密码隐藏时,第一次在授权框中输入密码样式为圆点;输入密码错误后第二次输入密码样式为星号(预期:授权窗口隐藏密码样式不变,始终为圆点);
125358 【分区编辑器】再次输入密码,密码不是明文
* 需求号:无
* 其他修改说明:无
* commit id0ad2367
-- Yang Min <yangmin@kylinos.cn> Tue, 05 Jul 2022 09:43:40 +0800
ukui-biometric-auth (1.2.0-1kylin60update3) v101; urgency=medium
* BUG号117501 【屏幕键盘】平板模式,授权窗口点击输入密码,屏幕键盘无法自动弹出(手动调出屏幕键盘后也无法弹出
117557 【用户授权】授权弹窗样式与设计稿不符
* 需求号:无
* 其他修改说明:无
* commit ide116557
-- Yang Min <yangmin@kylinos.cn> Tue, 28 Jun 2022 16:55:07 +0800
ukui-biometric-auth (3.20.0.0) v101; urgency=medium
* BUG号121957 【2107升级到2203系统】【系统登录】升级前录入指纹升级后登录界面没有指纹登录选项
* 需求号:无
* 其他修改说明:无
* commit id:0b7c654
-- Yang Min <yangmin@kylinos.cn> Thu, 16 Jun 2022 20:06:36 +0800
ukui-biometric-auth (1.2.0-1kylin60update2) v101; urgency=medium
* BUG号121957 【2107升级到2203系统】【系统登录】升级前录入指纹升级后登录界面没有指纹登录选项
* 需求号:无
* 其他修改说明:无
-- Yang Min <yangmin@kylinos.cn> Tue, 07 Jun 2022 17:39:18 +0800
ukui-biometric-auth (1.2.0-1kylin60update1) v101; urgency=medium
* BUG号111548 【授权】使用错误微信扫描,授权窗口文字出现重叠
113434 【生物特征管理工具】终端提权时,关闭生物特征总开关,仍然可以提权成功
113465 【提权】英文环境和深色主题下,授权窗口的提示显示不全,且颜色与设计稿不符
113738 【时间和日期】系统已录入人脸,绑定微信,修改时间服务器,来回切换授权方式,“器”字会跳到下一行且遮挡住下行内容
113924 【生物特征管理工具】接入指纹后,打开分区编辑器,授权界面会向下方扩展
114209 【提权】指纹和微信扫码同时存在时,禁用指纹后,输入错误密码,微信扫码和指纹识别消失
114757 【设计】【授权认证】输入密码验证提示文案未显示
115401 【x100】【通有】【提权】已录入一个指纹后在再次录入指纹的提权界面进行睡眠时会自动进行指纹认证失败操作
* 需求号:无
* 其他修改说明:无
-- Yang Min <yangmin@kylinos.cn> Sat, 07 May 2022 14:48:05 +0800
ukui-biometric-auth (1.2.0-1kylin60) v101; urgency=medium
* BUG号110712 【用户提权】当修改polkit认证使用root用户时polkit授权窗口显示的用户名为空
111524 【安全】授权窗口的口令输入框明文密码可以复制、剪切
113215 【分区编辑器】打卡分区编辑器,第一次输入错误密码授权,授权窗口抖动
* 需求号:无
* 其他修改说明:无
-- Yang Min <yangmin@kylinos.cn> Thu, 31 Mar 2022 11:33:56 +0800
ukui-biometric-auth (1.2.0-1kylin59) v101; urgency=medium
* BUG号111548 【授权】使用错误微信扫描,授权窗口文字出现重叠
* 需求号:无
* 其他修改说明:无
-- Yang Min <yangmin@kylinos.cn> Fri, 25 Mar 2022 10:06:47 +0800
ukui-biometric-auth (1.2.0-1kylin58) v101; urgency=medium
* BUG号106042 【安全中心】修改密码强度位32位后在控制面板删除用户授权认证无法通过
* 需求号:无
* 其他修改说明:无
-- Yang Min <yangmin@kylinos.cn> Thu, 17 Mar 2022 19:23:34 +0800
ukui-biometric-auth (1.2.0-1kylin57) v101; urgency=medium
* BUG号107825 【生物识别认证】【登录界面】UI设计有更新需同步更新涉及登录、锁屏界面细节见步骤描述
* 需求号:无
* 其他修改说明:无
-- Yang Min <yangmin@kylinos.cn> Wed, 16 Mar 2022 10:09:48 +0800
ukui-biometric-auth (1.2.0-1kylin56) v101; urgency=medium
* BUG号108387 【生物特征管理-指纹】打开终端执行sudo su后不进行生物识别认证直接关掉终端窗口再次打开终端执行sudo su 发现不会提示进行生物识别认证了
102000 【polkit提权】【必现】同时接入人脸指纹设备时在提权界面拔掉再插入人脸摄像头认证选项不更新仍仅为指纹无人脸
109632 【统一认证】网络状况不好情况下进行微信认证时,二维码置灰不显示,输入密码也会清空
* 需求号:无
* 其他修改说明:无
-- Yang Min <yangmin@kylinos.cn> Fri, 11 Mar 2022 19:18:07 +0800
ukui-biometric-auth (1.2.0-1kylin55) v101; urgency=medium
* BUG号107825 【生物识别认证】【登录界面】UI设计有更新需同步更新涉及登录、锁屏界面细节见步骤描述
* 需求号:无
* 其他修改说明:无
-- Yang Min <yangmin@kylinos.cn> Fri, 04 Mar 2022 16:05:55 +0800
ukui-biometric-auth (1.2.0-1kylin54) v101; urgency=medium
* BUG号103501 【设置】【安全中心】【Freetest】改变账户的密码强度后管理员授权界面提示信息显示时间太短
103963 【登录选项】断开网络后,解绑微信授权窗口一直闪烁网络连接失败
* 需求号:无
* 其他修改说明:无
-- Yang Min <yangmin@kylinos.cn> Tue, 01 Mar 2022 17:13:24 +0800
ukui-biometric-auth (1.2.0-1kylin53) v101; urgency=medium
* BUG号103471 【登录】用户锁定倒计时结束后,提示认证失败
103662 【授权】深色模式下,授权窗口的密码明文显示眼睛未做高亮显示
104660 【提权】用户锁定后,密码输入框变短
* 需求号:无
* 其他修改说明:无
-- Yang Min <yangmin@kylinos.cn> Wed, 26 Jan 2022 18:07:46 +0800
ukui-biometric-auth (1.2.0-1kylin52) v101; urgency=medium
* BUG号100365 【登录/锁屏】微信二维码登录的文案提示与设计稿不符
* 需求号:无
* 其他修改说明:无
-- Yang Min <yangmin@kylinos.cn> Fri, 14 Jan 2022 18:00:55 +0800
ukui-biometric-auth (1.2.0-1kylin51) v101; urgency=medium
* BUG号98470 【生物识别】【polkit提权】【必现】机器连接两个指纹设备亚略特和ft笔记本自带的ft9328且均已录入指纹特征此时polkit提权界面无法切换为人脸认证
* 需求号:无
* 其他修改说明:无
-- Yang Min <yangmin@kylinos.cn> Thu, 30 Dec 2021 21:12:43 +0800
ukui-biometric-auth (1.2.0-1kylin50) v101; urgency=medium
* BUG号96179 【授权窗口】开启生物识别后,提权界面的“提权介绍”信息处未调整显示存在遮挡,且随着生物识别认证失败次数增加,文字处宽度变窄
97812 【生物识别】【polkit提权】【必现】字体为15号的中文环境polkit提权界面选择扫码登录“等待扫描二维码”提示显示不全
93161 【分区编辑器】人脸认证时移除摄像头,仍可以点击重试按钮
* 需求号:无
* 其他修改说明:无
-- Yang Min <yangmin@kylinos.cn> Wed, 22 Dec 2021 18:49:56 +0800
ukui-biometric-auth (1.2.0-1kylin48) v101; urgency=medium
* BUG号92975 【账户信息】【用例198950】修改系统字体选择账户界面授权窗口字体未改变
91697 【账户信息】【用例198952】修改系统字体账户信息界面授权弹窗字体没有变化
* 需求号:无
* 其他修改说明:无
-- Yang Min <yangmin@kylinos.cn> Mon, 13 Dec 2021 10:04:24 +0800
ukui-biometric-auth (1.2.0-1kylin47) v101; urgency=medium
* BUG号94749 【需求-统一认证-9368】使用微信成功登录后进入锁屏界面依旧默认人脸认证
* 需求号:无
* 其他修改说明:无
-- Yang Min <yangmin@kylinos.cn> Fri, 10 Dec 2021 21:03:00 +0800
ukui-biometric-auth (1.2.0-1kylin46) v101; urgency=medium
* BUG号93971 【SP2 UI走查】【登录/锁屏】微信二维码登录的文案提示与设计稿不符
94143 【生物识别-需求-8987】【polkit提权】【必现】勾选指纹设备为默认设备且指纹特征为空时同时打开人脸识别且存在人脸特征。polkit提权仍默认使用指纹认证
* 需求号:无
* 其他修改说明:无
-- Yang Min <yangmin@kylinos.cn> Thu, 09 Dec 2021 18:35:32 +0800
ukui-biometric-auth (1.2.0-1kylin45) v101; urgency=medium
* BUG号93674 【提权】输入其他管理员用户最大的错误密码次数后,不会提示用户已锁定
92964 【polkit提权】授权窗口的密码输入框未汉化
* 需求号:无
* 其他修改说明:无
-- Yang Min <yangmin@kylinos.cn> Tue, 07 Dec 2021 18:11:43 +0800
ukui-biometric-auth (1.2.0-1kylin44) v101; urgency=medium
* BUG号93003 【统一认证】【必现】登录/锁屏/提权认证时,一种生物或扫码认证方式次数达到上限后,无法切换其他认证方式,只能用密码认证
90467 【需求-统一认证-9368】开机等待二维码显示后断开网络扫码下方提示为指纹且次数显示不正确
* 需求号:无
* 其他修改说明:无
-- Yang Min <yangmin@kylinos.cn> Mon, 06 Dec 2021 16:55:02 +0800
ukui-biometric-auth (1.2.0-1kylin37) v101; urgency=medium
* BUG号
* 需求号:#9368 微信认证、登录、解锁功能
* 其他修改说明:无
* 其他修改影响域:无
-- Yang Min <yangmin@kylinos.cn> Mon, 08 Nov 2021 09:35:07 +0800
ukui-biometric-auth (1.2.0-1kylin36) v101; urgency=medium
* 同步pam修改授权相关bug
-- lilin <lilin@kylinos.cn> Thu, 04 Nov 2021 13:53:28 +0800
ukui-biometric-auth (1.2.0-1kylin35) v101; urgency=medium
* bug#82903 【授权】在授权框输入错误密码后,密码明文功能失效
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Sun, 26 Sep 2021 18:45:42 +0800
ukui-biometric-auth (1.2.0-1kylin34) v101; urgency=medium
* bug#77597
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Mon, 13 Sep 2021 20:28:19 +0800
ukui-biometric-auth (1.2.0-1kylin33) v101; urgency=medium
* bug号79437 锁定时间1分钟偶尔闪现2分钟计数
* 需求号:无
* 其他:无
-- lilin <lilin@kylinos.cn> Sat, 11 Sep 2021 16:25:11 +0800
ukui-biometric-auth (1.2.0-1kylin32) v101; urgency=medium
* bug#77620
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Sat, 04 Sep 2021 10:19:02 +0800
ukui-biometric-auth (1.2.0-1kylin31) v101; urgency=medium
* bug#77749
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Thu, 02 Sep 2021 20:00:58 +0800
ukui-biometric-auth (1.2.0-1kylin30) v101; urgency=medium
* bug号75318,75138
* 需求号7690
* 其他:无
-- liudun <liudun@kylinos.cn> Tue, 24 Aug 2021 10:05:21 +0800
ukui-biometric-auth (1.2.0-1kylin29) v101; urgency=medium
* bug号
* 需求号:无
* 其他:字符适配
-- lilin <lilin@kylinos.cn> Tue, 17 Aug 2021 16:44:08 +0800
ukui-biometric-auth (1.2.0-1kylin28) v101; urgency=medium
* bug号
* 需求号:无
* 其他更新授权界面3.0
-- lilin <lilin@kylinos.cn> Mon, 16 Aug 2021 20:38:40 +0800
ukui-biometric-auth (1.2.0-1kylin27) v101; urgency=medium
* bug号
* 需求号7167
* 其他:无
-- lilin <lilin@kylinos.cn> Thu, 12 Aug 2021 22:20:43 +0800
ukui-biometric-auth (1.2.0-1kylin26) v101; urgency=medium
* 需求号:7690
* 改动说明:人脸透传
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Thu, 05 Aug 2021 21:34:51 +0800
ukui-biometric-auth (1.2.0-1kylin25) v101; urgency=medium
* bug#57593
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Wed, 14 Jul 2021 08:52:40 +0800
ukui-biometric-auth (1.2.0-1kylin24) v101; urgency=medium
*解决bug63025 【用例110404】【控制面板|时间日期】修改服务器地址,输入错误的密码后提示信息未汉化
*需求号:无
*其他改动说明:无
-- lilin <lilin@kylinos.cn> Tue, 13 Jul 2021 20:59:52 +0800
ukui-biometric-auth (1.2.0-1kylin23) v101; urgency=medium
* bug#57593 ,bug#51914
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Fri, 18 Jun 2021 20:57:16 +0800
ukui-biometric-auth (1.2.0-1kylin22) v101; urgency=medium
* bug#48700 插入拔除指纹等生物识别设备,通知中心的消息生物特诊无图标
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Thu, 22 Apr 2021 09:26:58 +0800
ukui-biometric-auth (1.2.0-1kylin21) v101; urgency=medium
* rebuild
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Fri, 09 Apr 2021 21:15:52 +0800
ukui-biometric-auth (1.2.0-1kylin19) v101; urgency=medium
* bug#31629 终端提权时在“请按下手指”提示后按下ctrl+c再录入正确指纹提示认证成功但实际没有提权成功
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Mon, 22 Mar 2021 10:16:58 +0800
ukui-biometric-auth (1.2.0-1kylin18) v101; urgency=medium
* bug#31124 不存在虹膜特征时,提权窗口选择“更多”后,仍有虹膜选项,且可以进入虹膜识别
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Thu, 18 Mar 2021 10:30:51 +0800
ukui-biometric-auth (1.2.0-1kylin17) v101; urgency=medium
* 打开生物特征管理工具开关不再需要权限
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Sun, 14 Mar 2021 18:54:17 +0800
ukui-biometric-auth (1.2.0-1kylin16) v101; urgency=medium
* bug#22059 将生物设为默认设备,重启服务,切换到密码认证,再切换到生物认证失败
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Tue, 09 Mar 2021 09:41:44 +0800
ukui-biometric-auth (1.2.0-1kylin15) v101; urgency=medium
* 解决bug#39524 重启服务的授权框概率性出现在桌面左上角
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Thu, 04 Mar 2021 09:53:33 +0800
ukui-biometric-auth (1.2.0-1kylin14) v101; urgency=medium
* 修改重启服务提示
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Tue, 02 Mar 2021 09:20:17 +0800
ukui-biometric-auth (1.2.0-1kylin13) v101; urgency=medium
* 解决ukui-greeter-wayland无法使用生物特征认证的问题
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Sat, 30 Jan 2021 18:21:21 +0800
ukui-biometric-auth (1.2.0-1kylin12) v101; urgency=medium
* 解决编译出错
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Sat, 30 Jan 2021 14:32:16 +0800
ukui-biometric-auth (1.2.0-1kylin11) v101; urgency=medium
* 完善pam模块
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Sat, 30 Jan 2021 11:54:29 +0800
ukui-biometric-auth (1.2.0-1kylin10) v101; urgency=medium
* 添加同时认证生物特征和密码的配置方法
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Sat, 30 Jan 2021 10:25:03 +0800
ukui-biometric-auth (1.2.0-1kylin9) v101; urgency=medium
* bug#31648 终端提权时,关闭生物特征总开关,仍然可以提权成功
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Wed, 27 Jan 2021 09:17:08 +0800
ukui-biometric-auth (1.2.0-1kylin8) v101; urgency=medium
* bug#27407 200%缩放下,授权窗口内容显示不完整
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Mon, 04 Jan 2021 14:19:30 +0800
ukui-biometric-auth (1.2.0-1kylin7) v101; urgency=medium
* bug#31116 普通用户进行提权操作时使用policy提权建议窗口显示当前的管理员用户即使只存在一个管理员用户
* bug#26131 存在多个管理员用户,在系统授权窗口中,切换不用管理员用户,授权界面闪烁
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Sun, 03 Jan 2021 11:46:34 +0800
ukui-biometric-auth (1.2.0-1kylin6) v101; urgency=medium
* bug#23754 已存在指纹特征,再次录入特征时在录入指纹窗口异常关闭应用,再次打开应用,之前的特征消失
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Sat, 19 Dec 2020 13:52:45 +0800
ukui-biometric-auth (1.2.0-1kylin5) v101; urgency=medium
* 隐藏详细按钮
* 修改授权窗口图标
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Sat, 28 Nov 2020 03:26:27 +0800
ukui-biometric-auth (1.2.0-1kylin4) v101; urgency=medium
* bug#20309 授权窗口在任务栏窗口没有图标
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Tue, 29 Sep 2020 11:14:21 +0800
ukui-biometric-auth (1.2.0-1kylin3) v101; urgency=medium
* bug#18011 【授权】窗口中详细内容显示不完整
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Mon, 14 Sep 2020 17:21:59 +0800
ukui-biometric-auth (1.2.0-1kylin2) v101; urgency=medium
* 修复第一次启动生物识别管理工具,打开生物识别开关后,
* 生物识别管理工具卡死的问题
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Thu, 04 Jun 2020 14:49:23 +0800
ukui-biometric-auth (1.2.0-1kylin1) v101; urgency=medium
* rebuild
-- liuyuanpeng <liuyuanpeng@kylinos.cn> Sat, 16 May 2020 15:57:33 +0800
ukui-biometric-auth (1.2.0-1) unstable; urgency=medium
* New upstream release.
* debian/control:
- Bump standards-vertion to 4.5.0.
-- handsome_feng <jianfengli@ubuntukylin.com> Mon, 24 Feb 2020 22:07:07 +0800
ukui-biometric-auth (1.0.4-1) unstable; urgency=medium
* Upload to unstable.
* New upstream release.
* debian/control:
- Bump standards-version to 4.4.1. No changes needed.
* debian/{compat,control}:
- Use debhelper-compat notation. Bump to DH compat level
version 12.
-- handsome_feng <jianfengli@ubuntukylin.com> Sat, 30 Nov 2019 17:16:35 +0800
ukui-biometric-auth (1.0.3-2) experimental; urgency=medium
* Debian/control:
- libpam-biometric: Breaks and Replaces ukui-polkit(<<1.0.3)
(Closes: #925377)
-- handsome_feng <jianfengli@ubuntukylin.com> Wed, 27 Mar 2019 11:58:32 +0800
ukui-biometric-auth (1.0.3-1) experimental; urgency=medium
* The dialog of su or sudo is replaced by command output.
* Autorestart biometric authentication if authentication failed.
* Change the path of some config files.
* Add biodrvctl script to control driver status.
* Add fr/pt/ru/es translation.
* Add a series of biometric image.
* migrate to cmake.
* Fix the bug that polit can't load qm file.
* Fix the bug that polkit can't load icon.
* Fix the bug that polkit doesn't exit when logout.
* debian/control:
- Now ukui-polkit provides polkit-1-auto-agent.
- Bump standards-version to 4.3.0.
-- handsome_feng <jianfengli@ubuntukylin.com> Thu, 21 Mar 2019 10:55:27 +0800
ukui-biometric-auth (1.0.2-1) unstable; urgency=medium
* Initial release. (Closes: #908469)
-- handsome_feng <jianfengli@ubuntukylin.com> Tue, 25 Sep 2018 15:37:06 +0800

47
debian/control vendored Normal file
View File

@ -0,0 +1,47 @@
Source: ukui-biometric-auth
Section: admin
Priority: optional
Maintainer: Kylin Team <team+kylin@tracker.debian.org>
Uploaders: handsome_feng <jianfengli@ubuntukylin.com>
Build-Depends: debhelper-compat (= 12),
cmake (>= 2.6),
qtbase5-dev,
libpam-dev,
libglib2.0-dev,
libopencv-dev,
libpolkit-qt5-1-dev,
qttools5-dev,
qttools5-dev-tools,
libqt5svg5-dev,
libgsettings-qt-dev,
pkg-config,
libkysdk-sysinfo-dev
Standards-Version: 4.5.0
Rules-Requires-Root: no
Homepage: https://github.com/ukui/ukui-biometric-auth
Vcs-Git: https://github.com/ukui/ukui-biometric.git
Vcs-Browser: https://github.com/ukui/ukui-biometric-auth
Package: libpam-biometric
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Suggests: biometric-auth
Breaks: ukui-polkit (<<1.0.3)
Replaces: ukui-polkit (<<1.0.3)
Description: Insertable authentication module for PAM
The indispensable part for biometric authentication in
ukui desktop environment.
This package contains a modules for PAM.
Package: ukui-polkit
Architecture: any
Depends: policykit-1,
libpam-biometric(>=3.20.0.10),
${shlibs:Depends},
${misc:Depends}
Suggests: biometric-auth
Provides: polkit-1-auth-agent
Description: UKUI authentication agent for PolicyKit-1
The ukui-polkit package supports general authentication and
biometric authentication that the service is provided by the
biometric-auth package.

23
debian/copyright vendored Normal file
View File

@ -0,0 +1,23 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: ukui-biometric-auth
Upstream-Contact: yanghao@kylinos.cn
Source: https://github.com/ukui/ukui-biometric-auth
Files: *
Copyright: 2018, yanghao <yanghao@kylinos.cn>
License: GPL-3+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Genaral Public License for more details.
.
You should have received a copy og the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".

10
debian/libpam-biometric.install vendored Normal file
View File

@ -0,0 +1,10 @@
/lib/security/*
/usr/bin/*
/usr/share/pam-configs/*
/usr/share/polkit-1/actions/*.policy
/usr/share/ukui-biometric/images/
/usr/share/ukui-biometric/i18n_qm/*.qm
/usr/share/ukui-biometric/i18n_qm/bioauth-bin/*.qm
/usr/share/ukui-biometric/ukui-biometric.conf
/usr/share/dbus-1/system-services/org.ukui.UniauthBackend.service
/etc/dbus-1/system.d/org.ukui.UniauthBackend.conf

3
debian/libpam-biometric.manpages vendored Normal file
View File

@ -0,0 +1,3 @@
man/bioctl.1
man/bioauth.1
man/biodrvctl.1

54
debian/libpam-biometric.postinst vendored Normal file
View File

@ -0,0 +1,54 @@
#!/bin/sh
set -e
#DEBHELPER#
pam-auth-update --package
#update default conf
config_file=/etc/biometric-auth/ukui-biometric.conf
delimeter='='
get_opt(){
file=$1
section=$2
key=$3
val=$(awk -F "$delimeter" '/\['${section}'\]/{a=1}(a==1 && "'${key}'"==$1){print $2;exit}' ${file})
echo ${val}
}
is_key_exist(){
file=$1
section=$2
key=$3
is_exist=$(awk -F "$delimeter" '/\['${section}'\]/{a=1}(a==1 && "'${key}'"==$1){print '1';exit}' ${file})
echo ${is_exist}
}
set_opt(){
file=$1
section=$2
key=$3
val=$4
contain_section=$(awk '/\['${section}'\]/ {print NR}' ${file})
if [ ${#contain_section} -gt 0 ]; then
is_exist=$(is_key_exist $file $section $key)
if [ "${is_exist}" = "1" ]; then
awk -F "$delimeter" '/\['${section}'\]/{a=1}(a==1 && "'${key}'"==$1){gsub($2,"'${val}'");a=0} {print $0}' ${file} 1<>${file}
else
sed -i "s/\[${section}\]/\[${section}\]\n${key}\=${val}/g" ${file}
fi
else
echo -e "\n[${section}]\n${key}=${val}" >> ${file}
sed -i "s/\-e//g" ${file}
fi
}
if [ ! -f ${config_file} ]; then
mkdir -p /etc/biometric-auth
cp /usr/share/ukui-biometric/ukui-biometric.conf ${config_file}
else
set_opt ${config_file} General UseFirstDevice true
set_opt ${config_file} General MaxFailedTimes 5
set_opt ${config_file} Functions EnableQRCode true
fi

6
debian/libpam-biometric.prerm vendored Normal file
View File

@ -0,0 +1,6 @@
#!/bin/sh
set -e
#DEBHELPER#
pam-auth-update --package --remove pam-biometric

8
debian/rules vendored Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/make -f
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export QT_SELECT := qt5
export NO_PKG_MANGLE=1
%:
dh $@

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (native)

9
debian/source/include-binaries vendored Normal file
View File

@ -0,0 +1,9 @@
images/FingerPrint.gif
images/FingerPrint.png
images/FingerVein.gif
images/FingerVein.png
images/icon.png
images/Iris.gif
images/Iris.png
images/VoicePrint.gif
images/VoicePrint.png

3
debian/ukui-polkit.install vendored Normal file
View File

@ -0,0 +1,3 @@
/etc/xdg/*
/usr/lib/*
/usr/share/ukui-biometric/i18n_qm/polkit/*.qm

3
debian/watch vendored Normal file
View File

@ -0,0 +1,3 @@
version=4
opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/ukui-biometric-auth-$1\.tar\.gz/ \
https://github.com/ukui/ukui-biometric-auth/releases .*/v?(\d\S+)\.tar\.gz

View File

@ -39,7 +39,7 @@ set_target_properties(pam_biometric PROPERTIES PREFIX "")
install(TARGETS pam_biometric DESTINATION /lib/security) install(TARGETS pam_biometric DESTINATION /lib/security)
install(FILES pam-configs/pam-biometric DESTINATION /usr/share/pam-configs) install(FILES pam-configs/pam-biometric DESTINATION /usr/share/pam-configs)
install(FILES data/ukui-biometric.conf DESTINATION /etc/biometric-auth) install(FILES data/ukui-biometric.conf DESTINATION /usr/share/ukui-biometric)
install(FILES install(FILES
${PROJECT_BINARY_DIR}/data/org.freedesktop.plicykit.pkexec.bioctl-helper.policy ${PROJECT_BINARY_DIR}/data/org.freedesktop.plicykit.pkexec.bioctl-helper.policy
${PROJECT_BINARY_DIR}/data/org.freedesktop.plicykit.pkexec.biodrvctl.policy ${PROJECT_BINARY_DIR}/data/org.freedesktop.plicykit.pkexec.biodrvctl.policy

View File

@ -7,8 +7,10 @@
<action id="org.freedesktop.policykit.pkexec.bioctl"> <action id="org.freedesktop.policykit.pkexec.bioctl">
<description>Run the biometric authentication control tool</description> <description>Run the biometric authentication control tool</description>
<description xml:lang="zh">运行生物识别认证控制工具</description> <description xml:lang="zh">运行生物识别认证控制工具</description>
<description xml:lang="bo">འཁོར་སྐྱོད་སྐྱེ་དངོས་ཀྱི་ངོས་འཛིན་ཁས་ལེན་ཚོད་འཛིན་ཡོ་བྱད།།</description>
<message>Authentication is required to enable or disable biometric authentication</message> <message>Authentication is required to enable or disable biometric authentication</message>
<message xml:lang="zh">开启或关闭生物识别认证需要进行身份验证</message> <message xml:lang="zh">开启或关闭生物识别认证需要进行身份验证</message>
<message xml:lang="bo">སྒོ་རྒྱག་པའམ་ཡང་ན་སྒོ་རྒྱག་པའི་སྐྱེ་དངོས་ངོས་འཛིན་བདེན་དཔངར་སྤྲོད་བྱེད་པར་ཐོབ་ཐང་གི་ཚོད་ལྟསར་སྤྲོད་བྱ་དགོས།</message>
<icon_name>stock_person</icon_name> <icon_name>stock_person</icon_name>
<defaults> <defaults>
<allow_any>no</allow_any> <allow_any>no</allow_any>

View File

@ -7,8 +7,10 @@
<action id="org.freedesktop.policykit.pkexec.biodrvctl"> <action id="org.freedesktop.policykit.pkexec.biodrvctl">
<description>Run the biometric device driver control tool</description> <description>Run the biometric device driver control tool</description>
<description xml:lang="zh">运行生物识别设备驱动控制工具</description> <description xml:lang="zh">运行生物识别设备驱动控制工具</description>
<description xml:lang="bo">སྐྱ་དངོས་དབྱེ་འབྱེད་སྒྲག་ཆས་ཀྱི་ཁ་ལོ་བའི་ཚོད་འཛིན་ཡོ་བྱད་</description>
<message>Authentication is required to change the status of biometric device's driver</message> <message>Authentication is required to change the status of biometric device's driver</message>
<message xml:lang="zh">改变生物识别设备驱动状态需要进行身份验证</message> <message xml:lang="zh">改变生物识别设备驱动状态需要进行身份验证</message>
<message xml:lang="bo">སྐྱ་དངོས་དབྱེ་འབྱེད་སྒྲག་ཆས་ཀྱི་ཁ་ལོ་བའི་གནས་ཚུལ་ལ་འགྱུར་ལྡོག་གཏོང་བར་བདེན་དཔང་ར་སྤྲད་བྱ་དགོས།</message>
<icon_name>stock_person</icon_name> <icon_name>stock_person</icon_name>
<defaults> <defaults>
<allow_any>auth_admin</allow_any> <allow_any>auth_admin</allow_any>

View File

@ -7,8 +7,10 @@
<action id="org.freedesktop.policykit.pkexec.biorestart"> <action id="org.freedesktop.policykit.pkexec.biorestart">
<description>Restart Service</description> <description>Restart Service</description>
<description xml:lang="zh">重启生物特征服务</description> <description xml:lang="zh">重启生物特征服务</description>
<description xml:lang="bo">བསྐྱར་དུ་ཞབས་འདེགས་ཞུ་བ</description>
<message>Authentication is required to restart biometric service</message> <message>Authentication is required to restart biometric service</message>
<message xml:lang="zh">重启生物特征服务需要身份验证</message> <message xml:lang="zh">重启生物特征服务需要身份验证</message>
<message xml:lang="bo">སྐྱ་དངོས་དབྱེ་འབྱེད་ཞབས་ཞུ་སླར་གསོ་བྱེད་པར་བདེན་དཔང་ར་སྤྲད་བྱ་དགོས།</message>
<icon_name>stock_person</icon_name> <icon_name>stock_person</icon_name>
<defaults> <defaults>
<allow_any>auth_admin</allow_any> <allow_any>auth_admin</allow_any>

View File

@ -1,5 +1,6 @@
[General] [General]
EnableAuth=false EnableAuth=false
EnableAuthApp=63
DefaultDevice= DefaultDevice=
DoubleAuth=false DoubleAuth=false
UserBind=false UserBind=false

View File

@ -20,6 +20,7 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <pwd.h> #include <pwd.h>
#include <syslog.h>
#include <security/pam_modules.h> #include <security/pam_modules.h>
#include <security/_pam_macros.h> #include <security/_pam_macros.h>
#include <string.h> #include <string.h>
@ -31,6 +32,8 @@
#include <signal.h> #include <signal.h>
#include <errno.h> #include <errno.h>
#define USER_CONFIG_FILE "/home/%s/.biometric_auth/ukui_biometric.conf"
/* Declare log function */ /* Declare log function */
extern int enable_debug; extern int enable_debug;
extern char *log_prefix; extern char *log_prefix;
@ -50,28 +53,70 @@ static void signal_handler(int signo)
logger("signal_handler is triggered\n"); logger("signal_handler is triggered\n");
} }
int enable_biometric_authentication_app()
{
char conf_file[] = GET_STR(CONFIG_FILE);
FILE *file;
char line[1024];
int i;
int is_enable = 0;
if((file = fopen(conf_file, "r")) == NULL){
logger("open configure file failed: %s\n", strerror(errno));
return 1;
}
while(fgets(line, sizeof(line), file)) {
i = sscanf(line, "EnableAuthApp=%d\n", &is_enable);
if(i > 0) {
logger("EnableAuthApp=%d\n", is_enable);
break;
}
}
fclose(file);
return is_enable;
}
/* /*
* Check if the service should use biometric authentication * Check if the service should use biometric authentication
*/ */
int service_filter(char *service) int service_filter(char *service)
{ {
//int is_enable = enable_biometric_authentication_app();
//syslog(LOG_INFO,"is_enable = %d service = %s\n",is_enable,service);
if (strcmp(service, "lightdm") == 0) { if (strcmp(service, "lightdm") == 0) {
int ret = system("/bin/chmod -f a+wr /tmp/bio.log"); int ret = system("/bin/chmod -f a+wr /tmp/bio.log");
(void)ret; /* Suppress gcc ignoring return value warning */ (void)ret; /* Suppress gcc ignoring return value warning */
//if(is_enable & 1 == 0)
// return 0;
return 1; return 1;
} }
if (strcmp(service, "ukui-screensaver-qt") == 0) if (strcmp(service, "ukui-screensaver-qt") == 0){
//if((is_enable & (1<<1)) == 0)
// return 0;
return 1; return 1;
if (strcmp(service, "sudo") == 0) }
if (strcmp(service, "polkit-1") == 0){
//if((is_enable & (1<<2)) == 0)
// return 0;
return 1; return 1;
if (strcmp(service, "login") == 0) }
if (strcmp(service, "sudo") == 0){
//if((is_enable & (1<<3)) == 0)
// return 0;
return 1; return 1;
if (strcmp(service, "su") == 0) }
if (strcmp(service, "su") == 0){
//if((is_enable & (1<<4)) == 0)
// return 0;
return 1; return 1;
// if (strcmp(service, "mate-screensaver") == 0) }
// return 1; if (strcmp(service, "login") == 0){
if (strcmp(service, "polkit-1") == 0) //if((is_enable & (1<<5)) == 0)
// return 0;
return 1; return 1;
}
#ifdef ENABLE_BIOTEST #ifdef ENABLE_BIOTEST
if (strcmp(service, "biotest") == 0) if (strcmp(service, "biotest") == 0)
return 1; return 1;
@ -104,11 +149,11 @@ int call_conversation(pam_handle_t *pamh, int msg_style, char *msg, char *resp)
status = conv_struct->conv(1, message, &response, conv_struct->appdata_ptr); status = conv_struct->conv(1, message, &response, conv_struct->appdata_ptr);
logger("Finish conv callback function\n"); logger("Finish conv callback function\n");
if (resp) if (resp && response->resp)
strcpy(resp, response->resp); strcpy(resp, response->resp);
/* Use typecast to suppress gcc warnings */ /* Use typecast to suppress gcc warnings */
free((void *)message[0]); free((void *)message[0]);
if (response) if (response->resp)
free(response->resp); free(response->resp);
free(response); free(response);
@ -395,18 +440,47 @@ int enable_by_polkit()
int enable_biometric_authentication(pam_handle_t *pamh) int enable_biometric_authentication(pam_handle_t *pamh)
{ {
char *username = NULL;
int is_found = 0;
int is_auth_enable = 0;
pam_get_item(pamh, PAM_USER, (const void **)&username);
if (username) {
char conf_file_user[256];
snprintf(conf_file_user, 255, USER_CONFIG_FILE, username);
FILE *file = NULL;
char line[1024], is_enable[16];
int i;
if((file = fopen(conf_file_user, "r")) == NULL){
logger("open configure file failed: %s\n", strerror(errno));
} else {
while(fgets(line, sizeof(line), file)) {
i = sscanf(line, "EnableAuth=%15s\n", is_enable);
if(i > 0) {
logger("EnableAuth=%s\n", is_enable);
is_found = 1;
break;
}
}
fclose(file);
if(!strcmp(is_enable, "true"))
is_auth_enable = 1;
}
}
if (is_found != 0) {
return is_auth_enable;
}
char conf_file[] = GET_STR(CONFIG_FILE); char conf_file[] = GET_STR(CONFIG_FILE);
FILE *file; FILE *file;
char line[1024], is_enable[16]; char line[1024], is_enable[16];
int i; int i;
if((file = fopen(conf_file, "r")) == NULL){ if((file = fopen(conf_file, "r")) == NULL){
logger("open configure file failed: %s\n", strerror(errno)); logger("open configure file failed: %s\n", strerror(errno));
return 0; return 0;
} }
while(fgets(line, sizeof(line), file)) { while(fgets(line, sizeof(line), file)) {
i = sscanf(line, "EnableAuth=%s\n", is_enable); i = sscanf(line, "EnableAuth=%15s\n", is_enable);
if(i > 0) { if(i > 0) {
logger("EnableAuth=%s\n", is_enable); logger("EnableAuth=%s\n", is_enable);
break; break;
@ -421,18 +495,47 @@ int enable_biometric_authentication(pam_handle_t *pamh)
int enable_qrcode_authentication(pam_handle_t *pamh) int enable_qrcode_authentication(pam_handle_t *pamh)
{ {
char *username = NULL;
int is_found = 0;
int is_auth_enable = 0;
pam_get_item(pamh, PAM_USER, (const void **)&username);
if (username) {
char conf_file_user[256];
snprintf(conf_file_user, 255, USER_CONFIG_FILE, username);
FILE *file = NULL;
char line[1024], is_enable[16];
int i;
if((file = fopen(conf_file_user, "r")) == NULL){
logger("open configure file failed: %s\n", strerror(errno));
} else {
while(fgets(line, sizeof(line), file)) {
i = sscanf(line, "EnableQRCode=%15s\n", is_enable);
if(i > 0) {
logger("EnableQRCode=%s\n", is_enable);
is_found = 1;
break;
}
}
fclose(file);
if(!strcmp(is_enable, "true"))
is_auth_enable = 1;
}
}
if (is_found != 0) {
return is_auth_enable;
}
char conf_file[] = GET_STR(CONFIG_FILE); char conf_file[] = GET_STR(CONFIG_FILE);
FILE *file; FILE *file;
char line[1024], is_enable[16]; char line[1024], is_enable[16];
int i; int i;
if((file = fopen(conf_file, "r")) == NULL){ if((file = fopen(conf_file, "r")) == NULL){
logger("open configure file failed: %s\n", strerror(errno)); logger("open configure file failed: %s\n", strerror(errno));
return 0; return 0;
} }
while(fgets(line, sizeof(line), file)) { while(fgets(line, sizeof(line), file)) {
i = sscanf(line, "EnableQRCode=%s\n", is_enable); i = sscanf(line, "EnableQRCode=%15s\n", is_enable);
if(i > 0) { if(i > 0) {
logger("EnableQRCode=%s\n", is_enable); logger("EnableQRCode=%s\n", is_enable);
break; break;
@ -502,8 +605,6 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc,
return PAM_IGNORE; return PAM_IGNORE;
} }
/* Different services use different processing function */ /* Different services use different processing function */
if (strcmp(service, "lightdm") == 0) { if (strcmp(service, "lightdm") == 0) {
char buf[128]; char buf[128];

View File

@ -3,11 +3,11 @@
# Usage: bioctl status|enable|disable # Usage: bioctl status|enable|disable
if [ "$1" = "enable" ]; then if [ "$1" = "enable" ]; then
pkexec /usr/bin/bioctl-helper enable pkexec /usr/bin/bioctl-helper enable $2
elif [ "$1" = "disable" ]; then elif [ "$1" = "disable" ]; then
pkexec /usr/bin/bioctl-helper disable pkexec /usr/bin/bioctl-helper disable $2
elif [ "$1" = "status" ]; then elif [ "$1" = "status" ]; then
/usr/bin/bioctl-helper status /usr/bin/bioctl-helper status $2
else else
echo "Usage: bioctl status|enable|disable" echo "Usage: bioctl status|enable|disable"
fi fi

View File

@ -23,6 +23,13 @@ if [ ! -f $CONFIG_FILE ]; then
fi fi
contain_key=`grep -c "^EnableAuth=" $CONFIG_FILE` contain_key=`grep -c "^EnableAuth=" $CONFIG_FILE`
contain_key_app=`grep -c "^EnableAuthApp=" $CONFIG_FILE`
greeter=1
screensaver=$[1<<1]
polkit=$[1<<2]
sudo=$[1<<3]
su=$[1<<4]
login=$[1<<5]
if [ "$1" = "enable" ]; then if [ "$1" = "enable" ]; then
test_privilege test_privilege
@ -34,22 +41,155 @@ if [ "$1" = "enable" ]; then
#执行 pam-auth-update 了。 #执行 pam-auth-update 了。
#pam-auth-update --package pam-biometric #pam-auth-update --package pam-biometric
if [[ $# > 1 ]] && [[ $2 = "greeter" ]]; then
if [ "$contain_key" = "1" ]; then if [ "$contain_key_app" = "1" ]; then
cur_status_app=`sed '/^EnableAuthApp=/!d;s/.*=//' $CONFIG_FILE`
cur_status_app=$[ $cur_status_app | $greeter ]
sed -i "s/^EnableAuthApp=[a-zA-Z0-9]*/EnableAuthApp=$cur_status_app/g" $CONFIG_FILE
else
echo "EnableAuthApp=63" >> $CONFIG_FILE
fi
elif [[ $# > 1 ]] && [[ $2 = "screensaver" ]]; then
if [ "$contain_key_app" = "1" ]; then
cur_status_app=`sed '/^EnableAuthApp=/!d;s/.*=//' $CONFIG_FILE`
cur_status_app=$[ $cur_status_app | $screensaver ]
sed -i "s/^EnableAuthApp=[a-zA-Z0-9]*/EnableAuthApp=$cur_status_app/g" $CONFIG_FILE
else
echo "EnableAuthApp=63" >> $CONFIG_FILE
fi
elif [[ $# > 1 ]] && [[ $2 = "sudo" ]]; then
if [ "$contain_key_app" = "1" ]; then
cur_status_app=`sed '/^EnableAuthApp=/!d;s/.*=//' $CONFIG_FILE`
cur_status_app=$[ $cur_status_app | $sudo ]
sed -i "s/^EnableAuthApp=[a-zA-Z0-9]*/EnableAuthApp=$cur_status_app/g" $CONFIG_FILE
else
echo "EnableAuthApp=63" >> $CONFIG_FILE
fi
elif [[ $# > 1 ]] && [[ $2 = "polkit" ]]; then
if [ "$contain_key_app" = "1" ]; then
cur_status_app=`sed '/^EnableAuthApp=/!d;s/.*=//' $CONFIG_FILE`
cur_status_app=$[ $cur_status_app | $polkit ]
sed -i "s/^EnableAuthApp=[a-zA-Z0-9]*/EnableAuthApp=$cur_status_app/g" $CONFIG_FILE
else
echo "EnableAuthApp=63" >> $CONFIG_FILE
fi
elif [[ $# > 1 ]] && [[ $2 = "su" ]]; then
if [ "$contain_key_app" = "1" ]; then
cur_status_app=`sed '/^EnableAuthApp=/!d;s/.*=//' $CONFIG_FILE`
cur_status_app=$[ $cur_status_app | $su ]
sed -i "s/^EnableAuthApp=[a-zA-Z0-9]*/EnableAuthApp=$cur_status_app/g" $CONFIG_FILE
else
echo "EnableAuthApp=63" >> $CONFIG_FILE
fi
elif [[ $# > 1 ]] && [[ $2 = "login" ]]; then
if [ "$contain_key_app" = "1" ]; then
cur_status_app=`sed '/^EnableAuthApp=/!d;s/.*=//' $CONFIG_FILE`
cur_status_app=$[ $cur_status_app | $login ]
sed -i "s/^EnableAuthApp=[a-zA-Z0-9]*/EnableAuthApp=$cur_status_app/g" $CONFIG_FILE
else
echo "EnableAuthApp=63" >> $CONFIG_FILE
fi
elif [ "$contain_key" = "1" ]; then
sed -i 's/^EnableAuth=[a-zA-Z0-9]*/EnableAuth=true/g' $CONFIG_FILE sed -i 's/^EnableAuth=[a-zA-Z0-9]*/EnableAuth=true/g' $CONFIG_FILE
else else
echo "EnableAuth=true" >> $CONFIG_FILE echo "EnableAuth=true" >> $CONFIG_FILE
fi fi
elif [ "$1" = "disable" ]; then elif [ "$1" = "disable" ]; then
test_privilege test_privilege
if [ "$contain_key" = "1" ]; then if [[ $# > 1 ]] && [[ $2 = "greeter" ]]; then
if [ "$contain_key_app" = "1" ]; then
cur_status_app=`sed '/^EnableAuthApp=/!d;s/.*=//' $CONFIG_FILE`
cur_status_app=$[ $cur_status_app & $[~$greeter] ]
sed -i "s/^EnableAuthApp=[a-zA-Z0-9]*/EnableAuthApp=$cur_status_app/g" $CONFIG_FILE
else
echo "EnableAuthApp=0" >> $CONFIG_FILE
fi
elif [[ $# > 1 ]] && [[ $2 = "screensaver" ]]; then
if [ "$contain_key_app" = "1" ]; then
cur_status_app=`sed '/^EnableAuthApp=/!d;s/.*=//' $CONFIG_FILE`
cur_status_app=$[ $cur_status_app & $[ ~$screensaver ]]
sed -i "s/^EnableAuthApp=[a-zA-Z0-9]*/EnableAuthApp=$cur_status_app/g" $CONFIG_FILE
else
echo "EnableAuthApp=0" >> $CONFIG_FILE
fi
elif [[ $# > 1 ]] && [[ $2 = "sudo" ]]; then
if [ "$contain_key_app" = "1" ]; then
cur_status_app=`sed '/^EnableAuthApp=/!d;s/.*=//' $CONFIG_FILE`
cur_status_app=$[ $cur_status_app & $[ ~$sudo ] ]
sed -i "s/^EnableAuthApp=[a-zA-Z0-9]*/EnableAuthApp=$cur_status_app/g" $CONFIG_FILE
else
echo "EnableAuthApp=0" >> $CONFIG_FILE
fi
elif [[ $# > 1 ]] && [[ $2 = "polkit" ]]; then
if [ "$contain_key_app" = "1" ]; then
cur_status_app=`sed '/^EnableAuthApp=/!d;s/.*=//' $CONFIG_FILE`
cur_status_app=$[ $cur_status_app & $[~$polkit] ]
sed -i "s/^EnableAuthApp=[a-zA-Z0-9]*/EnableAuthApp=$cur_status_app/g" $CONFIG_FILE
else
echo "EnableAuthApp=0" >> $CONFIG_FILE
fi
elif [[ $# > 1 ]] && [[ $2 = "su" ]]; then
if [ "$contain_key_app" = "1" ]; then
cur_status_app=`sed '/^EnableAuthApp=/!d;s/.*=//' $CONFIG_FILE`
cur_status_app=$[ $cur_status_app & $[~$su] ]
sed -i "s/^EnableAuthApp=[a-zA-Z0-9]*/EnableAuthApp=$cur_status_app/g" $CONFIG_FILE
else
echo "EnableAuthApp=0" >> $CONFIG_FILE
fi
elif [[ $# > 1 ]] && [[ $2 = "login" ]]; then
if [ "$contain_key_app" = "1" ]; then
cur_status_app=`sed '/^EnableAuthApp=/!d;s/.*=//' $CONFIG_FILE`
cur_status_app=$[ $cur_status_app & $[~$login] ]
sed -i "s/^EnableAuthApp=[a-zA-Z0-9]*/EnableAuthApp=$cur_status_app/g" $CONFIG_FILE
else
echo "EnableAuthApp=0" >> $CONFIG_FILE
fi
elif [ "$contain_key" = "1" ]; then
sed -i 's/^EnableAuth=[a-zA-Z0-9]*/EnableAuth=false/g' $CONFIG_FILE sed -i 's/^EnableAuth=[a-zA-Z0-9]*/EnableAuth=false/g' $CONFIG_FILE
else else
echo "EnableAuth=false" >> $CONFIG_FILE echo "EnableAuth=false" >> $CONFIG_FILE
fi fi
elif [ "$1" = "status" ]; then elif [ "$1" = "status" ]; then
cur_status=`sed '/^EnableAuth/!d;s/.*=//' $CONFIG_FILE` cur_status=`sed '/^EnableAuth=/!d;s/.*=//' $CONFIG_FILE`
if [ "$cur_status" = "true" ]; then cur_status_app=`sed '/^EnableAuthApp=/!d;s/.*=//' $CONFIG_FILE`
if [[ $# > 1 ]] && [[ $2 = "greeter" ]];then
if [ $[ $[cur_status_app] & $[greeter] ] = $greeter ]; then
echo "enable"
else
echo "disable"
fi
elif [[ $# > 1 ]] && [[ $2 = "screensaver" ]];then
if [ $[$cur_status_app & $screensaver] = $screensaver ]; then
echo "enable"
else
echo "disable"
fi
elif [[ $# > 1 ]] && [[ $2 = "sudo" ]];then
if [ $[$cur_status_app & $sudo] = $sudo ]; then
echo "enable"
else
echo "disable"
fi
elif [[ $# > 1 ]] && [[ $2 = "polkit" ]];then
if [ $[$cur_status_app & $polkit] = $polkit ]; then
echo "enable"
else
echo "disable"
fi
elif [[ $# > 1 ]] && [[ $2 = "su" ]];then
if [ $[$cur_status_app & $su] = $su ]; then
echo "enable"
else
echo "disable"
fi
elif [[ $# > 1 ]] && [[ $2 = "login" ]];then
if [ $[$cur_status_app & $login] = $login ]; then
echo "enable"
else
echo "disable"
fi
elif [ "$cur_status" = "true" ]; then
echo "enable" echo "enable"
else else
echo "disable" echo "disable"

View File

@ -35,6 +35,7 @@ else
fi fi
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
systemctl reset-failed biometric-authentication.service
systemctl restart biometric-authentication.service systemctl restart biometric-authentication.service
fi fi

View File

@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 2.6)
project(ukui-polkit-agent) project(ukui-polkit-agent)
pkg_check_modules(QGS REQUIRED gsettings-qt) pkg_check_modules(QGS REQUIRED gsettings-qt)
pkg_check_modules(KDKINFO REQUIRED kysdk-sysinfo)
find_package(PolkitQt5-1 REQUIRED 0.103.0) find_package(PolkitQt5-1 REQUIRED 0.103.0)
find_package(Qt5 COMPONENTS Core Widgets DBus X11Extras Xml Network Svg) find_package(Qt5 COMPONENTS Core Widgets DBus X11Extras Xml Network Svg)
@ -18,11 +19,17 @@ configure_file(
include_directories( include_directories(
${QGS_INCLUDE_DIRS} ${QGS_INCLUDE_DIRS}
${KDKINFO_INCLUDE_DIRS}
)
link_directories(
${KDKINFO_LIBRARY_DIRS}
) )
set(EXTRA_LIBS set(EXTRA_LIBS
${EXTRA_LIBS} ${EXTRA_LIBS}
${QGS_LIBRARIES} ${QGS_LIBRARIES}
${KDKINFO_LIBRARIES}
) )
include_directories( include_directories(
@ -42,6 +49,7 @@ set(polkit_SRCS
src/users.cpp src/users.cpp
src/pam-tally.c src/pam-tally.c
src/modeButton.cpp src/modeButton.cpp
src/kalabel.cpp
../common/generic.cpp ../common/generic.cpp
) )

View File

@ -9,180 +9,185 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.ui" line="299"/> <location filename="../src/mainwindow.ui" line="302"/>
<location filename="../src/mainwindow.cpp" line="836"/> <location filename="../src/mainwindow.cpp" line="882"/>
<location filename="../src/mainwindow.cpp" line="893"/> <location filename="../src/mainwindow.cpp" line="948"/>
<source>Biometric</source> <source>Biometric</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.ui" line="360"/> <location filename="../src/mainwindow.ui" line="373"/>
<source>use password</source> <source>use password</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.ui" line="331"/> <location filename="../src/mainwindow.ui" line="334"/>
<location filename="../src/mainwindow.cpp" line="838"/> <location filename="../src/mainwindow.cpp" line="884"/>
<source>Cancel</source> <source>Cancel</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.ui" line="350"/> <location filename="../src/mainwindow.ui" line="353"/>
<location filename="../src/mainwindow.cpp" line="834"/> <location filename="../src/mainwindow.cpp" line="880"/>
<source>Authenticate</source> <source>Authenticate</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="63"/> <location filename="../src/mainwindow.cpp" line="65"/>
<source>Authentication</source> <source>Authentication</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="161"/> <location filename="../src/mainwindow.cpp" line="164"/>
<location filename="../src/mainwindow.cpp" line="1111"/> <location filename="../src/mainwindow.cpp" line="1176"/>
<source>Failed to verify %1, please enter password to unlock</source> <source>Failed to verify %1, please enter password to unlock</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="165"/> <location filename="../src/mainwindow.cpp" line="168"/>
<location filename="../src/mainwindow.cpp" line="1113"/> <location filename="../src/mainwindow.cpp" line="1178"/>
<source>Unable to verify %1, please enter password to unlock</source> <source>Unable to verify %1, please enter password to unlock</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="171"/> <location filename="../src/mainwindow.cpp" line="175"/>
<source>Failed to verify %1, you still have %2 verification opportunities</source> <source>Failed to verify %1, you still have %2 verification opportunities</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="183"/> <location filename="../src/mainwindow.cpp" line="261"/>
<source>NET Exception</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="247"/>
<source>Please enter your password or enroll your fingerprint </source> <source>Please enter your password or enroll your fingerprint </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="475"/> <location filename="../src/mainwindow.cpp" line="511"/>
<source>This operation requires the administrator&apos;s authorization. Please enter your password to allow this operation.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="517"/>
<source>A program is attempting to perform an action that requires privileges.It requires authorization to perform the action.</source> <source>A program is attempting to perform an action that requires privileges.It requires authorization to perform the action.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="536"/> <location filename="../src/mainwindow.cpp" line="578"/>
<source>Password: </source> <source>Password: </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="538"/> <location filename="../src/mainwindow.cpp" line="580"/>
<source>_Password: </source> <source>_Password: </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="540"/> <location filename="../src/mainwindow.cpp" line="582"/>
<source>_Password:</source> <source>_Password:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="581"/> <location filename="../src/mainwindow.cpp" line="623"/>
<location filename="../src/mainwindow.cpp" line="585"/> <location filename="../src/mainwindow.cpp" line="627"/>
<location filename="../src/mainwindow.cpp" line="589"/> <location filename="../src/mainwindow.cpp" line="631"/>
<location filename="../src/mainwindow.cpp" line="593"/> <location filename="../src/mainwindow.cpp" line="635"/>
<source>Account locked,</source> <source>Account locked,</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="581"/> <location filename="../src/mainwindow.cpp" line="623"/>
<source>days left</source> <source>days left</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="585"/> <location filename="../src/mainwindow.cpp" line="627"/>
<source>hours left</source> <source>hours left</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="589"/> <location filename="../src/mainwindow.cpp" line="631"/>
<source>minutes left</source> <source>minutes left</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="593"/> <location filename="../src/mainwindow.cpp" line="635"/>
<source>seconds left</source> <source>seconds left</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="633"/> <location filename="../src/mainwindow.cpp" line="675"/>
<location filename="../src/mainwindow.cpp" line="634"/> <location filename="../src/mainwindow.cpp" line="676"/>
<source>Password cannot be empty</source> <source>Password cannot be empty</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="840"/> <location filename="../src/mainwindow.cpp" line="886"/>
<location filename="../src/mainwindow.cpp" line="927"/> <location filename="../src/mainwindow.cpp" line="991"/>
<source>Use password</source> <source>Use password</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="962"/> <location filename="../src/mainwindow.cpp" line="1026"/>
<location filename="../src/mainwindow.cpp" line="1029"/> <location filename="../src/mainwindow.cpp" line="1093"/>
<location filename="../src/mainwindow.cpp" line="1030"/> <location filename="../src/mainwindow.cpp" line="1094"/>
<source>Please try again in %1 minutes.</source> <source>Please try again in %1 minutes.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="972"/> <location filename="../src/mainwindow.cpp" line="1036"/>
<location filename="../src/mainwindow.cpp" line="1039"/> <location filename="../src/mainwindow.cpp" line="1103"/>
<location filename="../src/mainwindow.cpp" line="1040"/> <location filename="../src/mainwindow.cpp" line="1104"/>
<source>Please try again in %1 seconds.</source> <source>Please try again in %1 seconds.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="981"/> <location filename="../src/mainwindow.cpp" line="1045"/>
<location filename="../src/mainwindow.cpp" line="982"/> <location filename="../src/mainwindow.cpp" line="1046"/>
<location filename="../src/mainwindow.cpp" line="1048"/> <location filename="../src/mainwindow.cpp" line="1112"/>
<location filename="../src/mainwindow.cpp" line="1049"/> <location filename="../src/mainwindow.cpp" line="1113"/>
<source>Account locked permanently.</source> <source>Account locked permanently.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="1127"/> <location filename="../src/mainwindow.cpp" line="1193"/>
<source>Verify face recognition or enter password to unlock</source> <source>Verify face recognition or enter password to unlock</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="1132"/> <location filename="../src/mainwindow.cpp" line="1198"/>
<source>Press fingerprint or enter password to unlock</source> <source>Press fingerprint or enter password to unlock</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="1137"/> <location filename="../src/mainwindow.cpp" line="1203"/>
<source>Verify voiceprint or enter password to unlock</source> <source>Verify voiceprint or enter password to unlock</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="1142"/> <location filename="../src/mainwindow.cpp" line="1208"/>
<source>Verify finger vein or enter password to unlock</source> <source>Verify finger vein or enter password to unlock</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="1147"/> <location filename="../src/mainwindow.cpp" line="1213"/>
<source>Verify iris or enter password to unlock</source> <source>Verify iris or enter password to unlock</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="1152"/> <location filename="../src/mainwindow.cpp" line="1218"/>
<source>Use the bound wechat scanning code or enter the password to unlock</source> <source>Use the bound wechat scanning code or enter the password to unlock</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="534"/> <location filename="../src/mainwindow.cpp" line="576"/>
<source>Input Password</source> <source>Input Password</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="649"/> <location filename="../src/mainwindow.cpp" line="187"/>
<source>Abnormal network</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="691"/>
<source>Authentication failed, please try again.</source> <source>Authentication failed, please try again.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -190,17 +195,17 @@
<context> <context>
<name>PolkitListener</name> <name>PolkitListener</name>
<message> <message>
<location filename="../src/PolkitListener.cpp" line="59"/> <location filename="../src/PolkitListener.cpp" line="88"/>
<source>Another client is already authenticating, please try again later.</source> <source>Another client is already authenticating, please try again later.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/PolkitListener.cpp" line="226"/> <location filename="../src/PolkitListener.cpp" line="257"/>
<source>Authentication failure, please try again.</source> <source>Authentication failure, please try again.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/PolkitListener.cpp" line="233"/> <location filename="../src/PolkitListener.cpp" line="264"/>
<source>Password input error!</source> <source>Password input error!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View File

@ -1,194 +1,421 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS> <!DOCTYPE TS>
<TS version="2.1" language="bo_CN"> <TS version="2.1" language="bo_CN">
<context>
<name>BioAuthWidget</name>
<message>
<source>Retry</source>
<translation type="obsolete"></translation>
</message>
<message>
<source>%1 too many unsuccessful attempts,please enter password.</source>
<translation type="obsolete">%1使</translation>
</message>
<message>
<source>%1 authentication failure,there are still %2 remaining opportunities</source>
<translation type="obsolete">%1%2</translation>
</message>
<message>
<source>Please use wechat to scan the code</source>
<translation type="vanished">使</translation>
</message>
</context>
<context>
<name>BioDevices</name>
<message>
<source>FingerPrint</source>
<translation type="obsolete"></translation>
</message>
<message>
<source>FingerVein</source>
<translation type="obsolete"></translation>
</message>
<message>
<source>Iris</source>
<translation type="obsolete"></translation>
</message>
<message>
<source>Face</source>
<translation type="obsolete"></translation>
</message>
<message>
<source>VoicePrint</source>
<translation type="obsolete"></translation>
</message>
<message>
<source>Wechat</source>
<translation type="vanished"></translation>
</message>
<message>
<source>QRCode</source>
<translation type="vanished"></translation>
</message>
</context>
<context>
<name>LoginOptionsWidget</name>
<message>
<source>Login Options</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Wechat</source>
<translation type="vanished"></translation>
</message>
</context>
<context> <context>
<name>MainWindow</name> <name>MainWindow</name>
<message> <message>
<source>Form</source> <location filename="../src/mainwindow.cpp" line="65"/>
<translation></translation>
</message>
<message>
<source>days left</source>
<translation></translation>
</message>
<message>
<source>Please enter your password or enroll your fingerprint </source>
<translation></translation>
</message>
<message>
<source>Authenticate</source>
<translation></translation>
</message>
<message>
<source>in authentication, please wait...</source>
<translation type="vanished"> </translation>
</message>
<message>
<source>Authentication</source> <source>Authentication</source>
<translation></translation> <translation></translation>
</message>
<message>
<source>Cancel</source>
<translation></translation>
</message>
<message>
<source>Description:</source>
<translation type="vanished">:</translation>
</message>
<message>
<source>Biometric</source>
<translation></translation>
</message>
<message>
<source>Too many unsuccessful attempts,please enter password.</source>
<translation type="vanished"> </translation>
</message>
<message>
<source>Action:</source>
<translation type="vanished"></translation>
</message> </message>
<message> <message>
<source>Fingerprint authentication failed, you still have %1 verification opportunities</source> <source>Fingerprint authentication failed, you still have %1 verification opportunities</source>
<translation type="vanished"> </translation> <translation type="vanished">%1</translation>
</message> </message>
<message> <message>
<source>Polkit.caller-pid:</source> <location filename="../src/mainwindow.ui" line="26"/>
<translation type="vanished">Polkit.caller-pid</translation> <source>Form</source>
<translation></translation>
</message>
<message>
<source>More</source>
<translation type="obsolete"></translation>
</message>
<message>
<source>Restart</source>
<translation type="obsolete"></translation>
</message>
<message>
<source>Password</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../src/mainwindow.ui" line="302"/>
<location filename="../src/mainwindow.cpp" line="882"/>
<location filename="../src/mainwindow.cpp" line="948"/>
<source>Biometric</source>
<translation></translation>
</message>
<message>
<location filename="../src/mainwindow.ui" line="373"/>
<source>use password</source>
<translation></translation>
</message>
<message>
<source>DeviceType:</source>
<translation type="obsolete"></translation>
</message>
<message>
<source>Back</source>
<translation type="obsolete"></translation>
</message>
<message>
<source>Details</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Action Id:</source>
<translation type="obsolete">:</translation>
</message>
<message>
<source>Description:</source>
<translation type="vanished"></translation>
</message> </message>
<message> <message>
<source>Polkit.subject-pid:</source> <source>Polkit.subject-pid:</source>
<translation type="vanished">Polkit.subject-pid</translation> <translation type="vanished">Polkit.subject-pid</translation>
</message> </message>
<message> <message>
<source>Account locked,</source> <source>Retry</source>
<translation></translation> <translation type="obsolete"></translation>
</message> </message>
<message> <message>
<source>hours left</source> <source>Device types:</source>
<translation></translation> <translation type="obsolete"></translation>
</message>
<message>
<source>An application is attempting to perform an action that requires privileges. Authentication is required to perform this action.</source>
<translation type="vanished"> </translation>
</message>
<message>
<source>Details</source>
<translation type="vanished"></translation>
</message>
<message>
<source>Password: </source>
<translation></translation>
</message>
<message>
<source>minutes left</source>
<translation></translation>
</message>
<message>
<source>Authentication failed, please try again.</source>
<translation> </translation>
</message> </message>
<message> <message>
<source>Vendor:</source> <source>Vendor:</source>
<translation type="vanished"></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<source>seconds left</source> <source>Action:</source>
<translation></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<source>Password cannot be empty</source> <source>Polkit.caller-pid:</source>
<translation></translation> <translation type="vanished">Polkit.caller-pid</translation>
</message> </message>
<message> <message>
<source>use password</source> <location filename="../src/mainwindow.ui" line="334"/>
<translation type="unfinished"></translation> <location filename="../src/mainwindow.cpp" line="884"/>
<source>Cancel</source>
<translation></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.ui" line="353"/>
<location filename="../src/mainwindow.cpp" line="880"/>
<source>Authenticate</source>
<translation></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="886"/>
<location filename="../src/mainwindow.cpp" line="991"/>
<source>Use password</source> <source>Use password</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<source>Auth</source>
<translation type="obsolete"></translation>
</message>
<message>
<source>Too many unsuccessful attempts,please enter password.</source>
<translation type="vanished">使</translation>
</message>
<message>
<source>%1 authentication failure,there are still %2 remaining opportunities</source>
<translation type="vanished">%1%2</translation>
</message>
<message>
<source>%1 too many unsuccessful attempts,please enter password.</source>
<translation type="vanished">%1使</translation>
</message>
<message>
<source>in authentication, please wait...</source>
<translation type="vanished">...</translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="1026"/>
<location filename="../src/mainwindow.cpp" line="1093"/>
<location filename="../src/mainwindow.cpp" line="1094"/>
<source>Please try again in %1 minutes.</source> <source>Please try again in %1 minutes.</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="1036"/>
<location filename="../src/mainwindow.cpp" line="1103"/>
<location filename="../src/mainwindow.cpp" line="1104"/>
<source>Please try again in %1 seconds.</source> <source>Please try again in %1 seconds.</source>
<translation type="unfinished"></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="1045"/>
<location filename="../src/mainwindow.cpp" line="1046"/>
<location filename="../src/mainwindow.cpp" line="1112"/>
<location filename="../src/mainwindow.cpp" line="1113"/>
<source>Account locked permanently.</source> <source>Account locked permanently.</source>
<translation type="unfinished"></translation> <translation></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="675"/>
<location filename="../src/mainwindow.cpp" line="676"/>
<source>Password cannot be empty</source>
<translation></translation>
</message>
<message>
<source>Failed to verify %1, please enter password.</source>
<translation type="vanished">%1.</translation>
</message>
<message>
<source>Unable to verify %1, please enter password.</source>
<translation type="vanished">%1.</translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="175"/>
<source>Failed to verify %1, you still have %2 verification opportunities</source>
<translation>%1 %2</translation>
</message>
<message>
<source>An application is attempting to perform an action that requires privileges. Authentication is required to perform this action.</source>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="578"/>
<source>Password: </source>
<translation> </translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="261"/>
<source>Please enter your password or enroll your fingerprint </source>
<translation> </translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="187"/>
<source>Abnormal network</source>
<translation></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="511"/>
<source>This operation requires the administrator&apos;s authorization. Please enter your password to allow this operation.</source>
<translation> </translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="580"/>
<source>_Password: </source>
<translation>_Password </translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="582"/>
<source>_Password:</source>
<translation>_Password</translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="691"/>
<source>Authentication failed, please try again.</source>
<translation></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="623"/>
<source>days left</source>
<translation></translation>
</message>
<message>
<source>Biometric/code scan authentication failed too many times, please enter the password.</source>
<translation type="vanished">/使.</translation>
</message>
<message>
<source>Bioauth/code scan authentication failed, you still have %1 verification opportunities</source>
<translation type="vanished">/%1</translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="164"/>
<location filename="../src/mainwindow.cpp" line="1176"/>
<source>Failed to verify %1, please enter password to unlock</source>
<translation>%1 </translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="168"/>
<location filename="../src/mainwindow.cpp" line="1178"/>
<source>Unable to verify %1, please enter password to unlock</source>
<translation>%1 </translation>
</message> </message>
<message> <message>
<source>NET Exception</source> <source>NET Exception</source>
<translation type="unfinished"></translation> <translation type="vanished"></translation>
</message>
<message>
<source>Verify face recognition or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Press fingerprint or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Verify voiceprint or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Verify finger vein or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Verify iris or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Failed to verify %1, you still have %2 verification opportunities</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Input Password</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Use the bound wechat scanning code or enter the password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Failed to verify %1, please enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unable to verify %1, please enter password to unlock</source>
<translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="517"/>
<source>A program is attempting to perform an action that requires privileges.It requires authorization to perform the action.</source> <source>A program is attempting to perform an action that requires privileges.It requires authorization to perform the action.</source>
<translation type="unfinished"></translation> <translation> </translation>
</message> </message>
<message> <message>
<source>_Password:</source> <location filename="../src/mainwindow.cpp" line="576"/>
<translation type="unfinished"></translation> <source>Input Password</source>
<translation></translation>
</message> </message>
<message> <message>
<source>_Password: </source> <location filename="../src/mainwindow.cpp" line="627"/>
<translation type="unfinished"></translation> <source>hours left</source>
<translation></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="631"/>
<source>minutes left</source>
<translation></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="635"/>
<source>seconds left</source>
<translation></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="1193"/>
<source>Verify face recognition or enter password to unlock</source>
<translation></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="1198"/>
<source>Press fingerprint or enter password to unlock</source>
<translation></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="1203"/>
<source>Verify voiceprint or enter password to unlock</source>
<translation></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="1208"/>
<source>Verify finger vein or enter password to unlock</source>
<translation></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="1213"/>
<source>Verify iris or enter password to unlock</source>
<translation>iris </translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="1218"/>
<source>Use the bound wechat scanning code or enter the password to unlock</source>
<translation></translation>
</message>
<message>
<source>Use the bound wechat scanning code or enter the password to log in</source>
<translation type="vanished">使</translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="623"/>
<location filename="../src/mainwindow.cpp" line="627"/>
<location filename="../src/mainwindow.cpp" line="631"/>
<location filename="../src/mainwindow.cpp" line="635"/>
<source>Account locked,</source>
<translation></translation>
</message>
<message>
<source>Authentication failed, please try again</source>
<translation type="obsolete"></translation>
</message> </message>
</context> </context>
<context> <context>
<name>PolkitListener</name> <name>PolkitListener</name>
<message> <message>
<source>Authentication failure, please try again.</source> <location filename="../src/PolkitListener.cpp" line="88"/>
<translation> </translation>
</message>
<message>
<source>Another client is already authenticating, please try again later.</source> <source>Another client is already authenticating, please try again later.</source>
<translation> </translation> <translation> </translation>
</message> </message>
<message> <message>
<location filename="../src/PolkitListener.cpp" line="257"/>
<source>Authentication failure, please try again.</source>
<translation></translation>
</message>
<message>
<location filename="../src/PolkitListener.cpp" line="264"/>
<source>Password input error!</source> <source>Password input error!</source>
<translation type="unfinished"></translation> <translation></translation>
</message>
<message>
<source>Account locked %1 minutes due to %2 fail attempts</source>
<translation type="vanished">%1%2</translation>
</message>
<message>
<source>Authentication failure,there are still %1 remaining opportunities</source>
<translation type="vanished">%1</translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<source>FingerPrint</source>
<translation type="obsolete"></translation>
</message>
<message>
<source>FingerVein</source>
<translation type="obsolete"></translation>
</message>
<message>
<source>Iris</source>
<translation type="obsolete"></translation>
</message>
<message>
<source>Face</source>
<translation type="obsolete"></translation>
</message>
<message>
<source>VoicePrint</source>
<translation type="obsolete"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="obsolete"></translation>
</message> </message>
</context> </context>
</TS> </TS>

View File

@ -145,10 +145,6 @@
<source>Verify iris or enter password to unlock</source> <source>Verify iris or enter password to unlock</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>NET Exception</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Failed to verify %1, you still have %2 verification opportunities</source> <source>Failed to verify %1, you still have %2 verification opportunities</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -181,6 +177,14 @@
<source>_Password: </source> <source>_Password: </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Abnormal network</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This operation requires the administrator&apos;s authorization. Please enter your password to allow this operation.</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>PolkitListener</name> <name>PolkitListener</name>

View File

@ -145,10 +145,6 @@
<source>Verify iris or enter password to unlock</source> <source>Verify iris or enter password to unlock</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>NET Exception</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Failed to verify %1, you still have %2 verification opportunities</source> <source>Failed to verify %1, you still have %2 verification opportunities</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -181,6 +177,14 @@
<source>_Password: </source> <source>_Password: </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Abnormal network</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This operation requires the administrator&apos;s authorization. Please enter your password to allow this operation.</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>PolkitListener</name> <name>PolkitListener</name>

View File

@ -145,10 +145,6 @@
<source>Verify iris or enter password to unlock</source> <source>Verify iris or enter password to unlock</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>NET Exception</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Failed to verify %1, you still have %2 verification opportunities</source> <source>Failed to verify %1, you still have %2 verification opportunities</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -181,6 +177,14 @@
<source>_Password: </source> <source>_Password: </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Abnormal network</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This operation requires the administrator&apos;s authorization. Please enter your password to allow this operation.</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>PolkitListener</name> <name>PolkitListener</name>

View File

@ -145,10 +145,6 @@
<source>Verify iris or enter password to unlock</source> <source>Verify iris or enter password to unlock</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>NET Exception</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Failed to verify %1, you still have %2 verification opportunities</source> <source>Failed to verify %1, you still have %2 verification opportunities</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -181,6 +177,14 @@
<source>_Password: </source> <source>_Password: </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Abnormal network</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This operation requires the administrator&apos;s authorization. Please enter your password to allow this operation.</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>PolkitListener</name> <name>PolkitListener</name>

View File

@ -34,131 +34,136 @@
<context> <context>
<name>MainWindow</name> <name>MainWindow</name>
<message> <message>
<location filename="../src/mainwindow.cpp" line="63"/> <location filename="../src/mainwindow.cpp" line="65"/>
<source>Authentication</source> <source>Authentication</source>
<translation>Kimlik Doğrulama</translation> <translation>Kimlik Doğrulama</translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="161"/> <location filename="../src/mainwindow.cpp" line="164"/>
<location filename="../src/mainwindow.cpp" line="1111"/> <location filename="../src/mainwindow.cpp" line="1176"/>
<source>Failed to verify %1, please enter password to unlock</source> <source>Failed to verify %1, please enter password to unlock</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="165"/> <location filename="../src/mainwindow.cpp" line="168"/>
<location filename="../src/mainwindow.cpp" line="1113"/> <location filename="../src/mainwindow.cpp" line="1178"/>
<source>Unable to verify %1, please enter password to unlock</source> <source>Unable to verify %1, please enter password to unlock</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="171"/> <location filename="../src/mainwindow.cpp" line="175"/>
<source>Failed to verify %1, you still have %2 verification opportunities</source> <source>Failed to verify %1, you still have %2 verification opportunities</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="183"/> <location filename="../src/mainwindow.cpp" line="187"/>
<source>NET Exception</source> <source>Abnormal network</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="475"/> <location filename="../src/mainwindow.cpp" line="511"/>
<source>This operation requires the administrator&apos;s authorization. Please enter your password to allow this operation.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="517"/>
<source>A program is attempting to perform an action that requires privileges.It requires authorization to perform the action.</source> <source>A program is attempting to perform an action that requires privileges.It requires authorization to perform the action.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="534"/> <location filename="../src/mainwindow.cpp" line="576"/>
<source>Input Password</source> <source>Input Password</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="581"/> <location filename="../src/mainwindow.cpp" line="623"/>
<location filename="../src/mainwindow.cpp" line="585"/> <location filename="../src/mainwindow.cpp" line="627"/>
<location filename="../src/mainwindow.cpp" line="589"/> <location filename="../src/mainwindow.cpp" line="631"/>
<location filename="../src/mainwindow.cpp" line="593"/> <location filename="../src/mainwindow.cpp" line="635"/>
<source>Account locked,</source> <source>Account locked,</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="581"/> <location filename="../src/mainwindow.cpp" line="623"/>
<source>days left</source> <source>days left</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="585"/> <location filename="../src/mainwindow.cpp" line="627"/>
<source>hours left</source> <source>hours left</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="589"/> <location filename="../src/mainwindow.cpp" line="631"/>
<source>minutes left</source> <source>minutes left</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="593"/> <location filename="../src/mainwindow.cpp" line="635"/>
<source>seconds left</source> <source>seconds left</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="633"/> <location filename="../src/mainwindow.cpp" line="675"/>
<location filename="../src/mainwindow.cpp" line="634"/> <location filename="../src/mainwindow.cpp" line="676"/>
<source>Password cannot be empty</source> <source>Password cannot be empty</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="840"/> <location filename="../src/mainwindow.cpp" line="886"/>
<location filename="../src/mainwindow.cpp" line="927"/> <location filename="../src/mainwindow.cpp" line="991"/>
<source>Use password</source> <source>Use password</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="962"/> <location filename="../src/mainwindow.cpp" line="1026"/>
<location filename="../src/mainwindow.cpp" line="1029"/> <location filename="../src/mainwindow.cpp" line="1093"/>
<location filename="../src/mainwindow.cpp" line="1030"/> <location filename="../src/mainwindow.cpp" line="1094"/>
<source>Please try again in %1 minutes.</source> <source>Please try again in %1 minutes.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="972"/> <location filename="../src/mainwindow.cpp" line="1036"/>
<location filename="../src/mainwindow.cpp" line="1039"/> <location filename="../src/mainwindow.cpp" line="1103"/>
<location filename="../src/mainwindow.cpp" line="1040"/> <location filename="../src/mainwindow.cpp" line="1104"/>
<source>Please try again in %1 seconds.</source> <source>Please try again in %1 seconds.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="981"/> <location filename="../src/mainwindow.cpp" line="1045"/>
<location filename="../src/mainwindow.cpp" line="982"/> <location filename="../src/mainwindow.cpp" line="1046"/>
<location filename="../src/mainwindow.cpp" line="1048"/> <location filename="../src/mainwindow.cpp" line="1112"/>
<location filename="../src/mainwindow.cpp" line="1049"/> <location filename="../src/mainwindow.cpp" line="1113"/>
<source>Account locked permanently.</source> <source>Account locked permanently.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="1127"/> <location filename="../src/mainwindow.cpp" line="1193"/>
<source>Verify face recognition or enter password to unlock</source> <source>Verify face recognition or enter password to unlock</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="1132"/> <location filename="../src/mainwindow.cpp" line="1198"/>
<source>Press fingerprint or enter password to unlock</source> <source>Press fingerprint or enter password to unlock</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="1137"/> <location filename="../src/mainwindow.cpp" line="1203"/>
<source>Verify voiceprint or enter password to unlock</source> <source>Verify voiceprint or enter password to unlock</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="1142"/> <location filename="../src/mainwindow.cpp" line="1208"/>
<source>Verify finger vein or enter password to unlock</source> <source>Verify finger vein or enter password to unlock</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="1147"/> <location filename="../src/mainwindow.cpp" line="1213"/>
<source>Verify iris or enter password to unlock</source> <source>Verify iris or enter password to unlock</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="1152"/> <location filename="../src/mainwindow.cpp" line="1218"/>
<source>Use the bound wechat scanning code or enter the password to unlock</source> <source>Use the bound wechat scanning code or enter the password to unlock</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -180,9 +185,9 @@
<translation type="obsolete">Parola</translation> <translation type="obsolete">Parola</translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.ui" line="299"/> <location filename="../src/mainwindow.ui" line="302"/>
<location filename="../src/mainwindow.cpp" line="836"/> <location filename="../src/mainwindow.cpp" line="882"/>
<location filename="../src/mainwindow.cpp" line="893"/> <location filename="../src/mainwindow.cpp" line="948"/>
<source>Biometric</source> <source>Biometric</source>
<translation>Biyometrik</translation> <translation>Biyometrik</translation>
</message> </message>
@ -231,19 +236,19 @@
<translation type="vanished">Polkit.caller-pid</translation> <translation type="vanished">Polkit.caller-pid</translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.ui" line="331"/> <location filename="../src/mainwindow.ui" line="334"/>
<location filename="../src/mainwindow.cpp" line="838"/> <location filename="../src/mainwindow.cpp" line="884"/>
<source>Cancel</source> <source>Cancel</source>
<translation>İptal</translation> <translation>İptal</translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.ui" line="350"/> <location filename="../src/mainwindow.ui" line="353"/>
<location filename="../src/mainwindow.cpp" line="834"/> <location filename="../src/mainwindow.cpp" line="880"/>
<source>Authenticate</source> <source>Authenticate</source>
<translation>Kimlik Doğrulaması</translation> <translation>Kimlik Doğrulaması</translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.ui" line="360"/> <location filename="../src/mainwindow.ui" line="373"/>
<source>use password</source> <source>use password</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -252,7 +257,7 @@
<translation type="obsolete">Kimlik Doğrulaması</translation> <translation type="obsolete">Kimlik Doğrulaması</translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="247"/> <location filename="../src/mainwindow.cpp" line="261"/>
<source>Please enter your password or enroll your fingerprint </source> <source>Please enter your password or enroll your fingerprint </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -265,22 +270,22 @@
<translation type="vanished">Bir uygulama, ayrıcalıklar gerektiren bir eylem gerçekleştirmeye çalışıyor. Bu işlemi gerçekleştirmek için kimlik doğrulaması gerekiyor.</translation> <translation type="vanished">Bir uygulama, ayrıcalıklar gerektiren bir eylem gerçekleştirmeye çalışıyor. Bu işlemi gerçekleştirmek için kimlik doğrulaması gerekiyor.</translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="536"/> <location filename="../src/mainwindow.cpp" line="578"/>
<source>Password: </source> <source>Password: </source>
<translation type="unfinished">Parola </translation> <translation type="unfinished">Parola </translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="538"/> <location filename="../src/mainwindow.cpp" line="580"/>
<source>_Password: </source> <source>_Password: </source>
<translation type="unfinished">_Parola </translation> <translation type="unfinished">_Parola </translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="540"/> <location filename="../src/mainwindow.cpp" line="582"/>
<source>_Password:</source> <source>_Password:</source>
<translation type="unfinished">_Parola</translation> <translation type="unfinished">_Parola</translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="649"/> <location filename="../src/mainwindow.cpp" line="691"/>
<source>Authentication failed, please try again.</source> <source>Authentication failed, please try again.</source>
<translation>Kimlik doğrulama başarısız, lütfen tekrar deneyin.</translation> <translation>Kimlik doğrulama başarısız, lütfen tekrar deneyin.</translation>
</message> </message>
@ -292,17 +297,17 @@
<context> <context>
<name>PolkitListener</name> <name>PolkitListener</name>
<message> <message>
<location filename="../src/PolkitListener.cpp" line="59"/> <location filename="../src/PolkitListener.cpp" line="88"/>
<source>Another client is already authenticating, please try again later.</source> <source>Another client is already authenticating, please try again later.</source>
<translation>Başka bir hesap zaten kimlik doğrulaması yapıyor, lütfen daha sonra tekrar deneyin.</translation> <translation>Başka bir hesap zaten kimlik doğrulaması yapıyor, lütfen daha sonra tekrar deneyin.</translation>
</message> </message>
<message> <message>
<location filename="../src/PolkitListener.cpp" line="226"/> <location filename="../src/PolkitListener.cpp" line="257"/>
<source>Authentication failure, please try again.</source> <source>Authentication failure, please try again.</source>
<translation>Kimlik doğrulama hatalı, lütfen tekrar deneyin.</translation> <translation>Kimlik doğrulama hatalı, lütfen tekrar deneyin.</translation>
</message> </message>
<message> <message>
<location filename="../src/PolkitListener.cpp" line="233"/> <location filename="../src/PolkitListener.cpp" line="264"/>
<source>Password input error!</source> <source>Password input error!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View File

@ -65,7 +65,7 @@
<context> <context>
<name>MainWindow</name> <name>MainWindow</name>
<message> <message>
<location filename="../src/mainwindow.cpp" line="63"/> <location filename="../src/mainwindow.cpp" line="65"/>
<source>Authentication</source> <source>Authentication</source>
<translation></translation> <translation></translation>
</message> </message>
@ -91,14 +91,14 @@
<translation type="vanished"></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.ui" line="299"/> <location filename="../src/mainwindow.ui" line="302"/>
<location filename="../src/mainwindow.cpp" line="836"/> <location filename="../src/mainwindow.cpp" line="882"/>
<location filename="../src/mainwindow.cpp" line="893"/> <location filename="../src/mainwindow.cpp" line="948"/>
<source>Biometric</source> <source>Biometric</source>
<translation>使</translation> <translation>使</translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.ui" line="360"/> <location filename="../src/mainwindow.ui" line="373"/>
<source>use password</source> <source>use password</source>
<translation>使</translation> <translation>使</translation>
</message> </message>
@ -147,20 +147,20 @@
<translation type="vanished">Polkit.caller-pid</translation> <translation type="vanished">Polkit.caller-pid</translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.ui" line="331"/> <location filename="../src/mainwindow.ui" line="334"/>
<location filename="../src/mainwindow.cpp" line="838"/> <location filename="../src/mainwindow.cpp" line="884"/>
<source>Cancel</source> <source>Cancel</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.ui" line="350"/> <location filename="../src/mainwindow.ui" line="353"/>
<location filename="../src/mainwindow.cpp" line="834"/> <location filename="../src/mainwindow.cpp" line="880"/>
<source>Authenticate</source> <source>Authenticate</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="840"/> <location filename="../src/mainwindow.cpp" line="886"/>
<location filename="../src/mainwindow.cpp" line="927"/> <location filename="../src/mainwindow.cpp" line="991"/>
<source>Use password</source> <source>Use password</source>
<translation>使</translation> <translation>使</translation>
</message> </message>
@ -185,30 +185,30 @@
<translation type="vanished">...</translation> <translation type="vanished">...</translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="962"/> <location filename="../src/mainwindow.cpp" line="1026"/>
<location filename="../src/mainwindow.cpp" line="1029"/> <location filename="../src/mainwindow.cpp" line="1093"/>
<location filename="../src/mainwindow.cpp" line="1030"/> <location filename="../src/mainwindow.cpp" line="1094"/>
<source>Please try again in %1 minutes.</source> <source>Please try again in %1 minutes.</source>
<translation>%1</translation> <translation>%1</translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="972"/> <location filename="../src/mainwindow.cpp" line="1036"/>
<location filename="../src/mainwindow.cpp" line="1039"/> <location filename="../src/mainwindow.cpp" line="1103"/>
<location filename="../src/mainwindow.cpp" line="1040"/> <location filename="../src/mainwindow.cpp" line="1104"/>
<source>Please try again in %1 seconds.</source> <source>Please try again in %1 seconds.</source>
<translation>%1</translation> <translation>%1</translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="981"/> <location filename="../src/mainwindow.cpp" line="1045"/>
<location filename="../src/mainwindow.cpp" line="982"/> <location filename="../src/mainwindow.cpp" line="1046"/>
<location filename="../src/mainwindow.cpp" line="1048"/> <location filename="../src/mainwindow.cpp" line="1112"/>
<location filename="../src/mainwindow.cpp" line="1049"/> <location filename="../src/mainwindow.cpp" line="1113"/>
<source>Account locked permanently.</source> <source>Account locked permanently.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="633"/> <location filename="../src/mainwindow.cpp" line="675"/>
<location filename="../src/mainwindow.cpp" line="634"/> <location filename="../src/mainwindow.cpp" line="676"/>
<source>Password cannot be empty</source> <source>Password cannot be empty</source>
<translation></translation> <translation></translation>
</message> </message>
@ -221,7 +221,7 @@
<translation type="vanished">%1.</translation> <translation type="vanished">%1.</translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="171"/> <location filename="../src/mainwindow.cpp" line="175"/>
<source>Failed to verify %1, you still have %2 verification opportunities</source> <source>Failed to verify %1, you still have %2 verification opportunities</source>
<translation>%1%2</translation> <translation>%1%2</translation>
</message> </message>
@ -230,32 +230,42 @@
<translation type="vanished"></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="536"/> <location filename="../src/mainwindow.cpp" line="578"/>
<source>Password: </source> <source>Password: </source>
<translation> </translation> <translation> </translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="247"/> <location filename="../src/mainwindow.cpp" line="261"/>
<source>Please enter your password or enroll your fingerprint </source> <source>Please enter your password or enroll your fingerprint </source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="538"/> <location filename="../src/mainwindow.cpp" line="187"/>
<source>Abnormal network</source>
<translation></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="511"/>
<source>This operation requires the administrator&apos;s authorization. Please enter your password to allow this operation.</source>
<translation></translation>
</message>
<message>
<location filename="../src/mainwindow.cpp" line="580"/>
<source>_Password: </source> <source>_Password: </source>
<translation> </translation> <translation> </translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="540"/> <location filename="../src/mainwindow.cpp" line="582"/>
<source>_Password:</source> <source>_Password:</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="649"/> <location filename="../src/mainwindow.cpp" line="691"/>
<source>Authentication failed, please try again.</source> <source>Authentication failed, please try again.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="581"/> <location filename="../src/mainwindow.cpp" line="623"/>
<source>days left</source> <source>days left</source>
<translation></translation> <translation></translation>
</message> </message>
@ -268,74 +278,73 @@
<translation type="vanished">/%1</translation> <translation type="vanished">/%1</translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="161"/> <location filename="../src/mainwindow.cpp" line="164"/>
<location filename="../src/mainwindow.cpp" line="1111"/> <location filename="../src/mainwindow.cpp" line="1176"/>
<source>Failed to verify %1, please enter password to unlock</source> <source>Failed to verify %1, please enter password to unlock</source>
<translation>%1</translation> <translation>%1</translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="165"/> <location filename="../src/mainwindow.cpp" line="168"/>
<location filename="../src/mainwindow.cpp" line="1113"/> <location filename="../src/mainwindow.cpp" line="1178"/>
<source>Unable to verify %1, please enter password to unlock</source> <source>Unable to verify %1, please enter password to unlock</source>
<translation>%1</translation> <translation>%1</translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="183"/>
<source>NET Exception</source> <source>NET Exception</source>
<translation></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="475"/> <location filename="../src/mainwindow.cpp" line="517"/>
<source>A program is attempting to perform an action that requires privileges.It requires authorization to perform the action.</source> <source>A program is attempting to perform an action that requires privileges.It requires authorization to perform the action.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="534"/> <location filename="../src/mainwindow.cpp" line="576"/>
<source>Input Password</source> <source>Input Password</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="585"/> <location filename="../src/mainwindow.cpp" line="627"/>
<source>hours left</source> <source>hours left</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="589"/> <location filename="../src/mainwindow.cpp" line="631"/>
<source>minutes left</source> <source>minutes left</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="593"/> <location filename="../src/mainwindow.cpp" line="635"/>
<source>seconds left</source> <source>seconds left</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="1127"/> <location filename="../src/mainwindow.cpp" line="1193"/>
<source>Verify face recognition or enter password to unlock</source> <source>Verify face recognition or enter password to unlock</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="1132"/> <location filename="../src/mainwindow.cpp" line="1198"/>
<source>Press fingerprint or enter password to unlock</source> <source>Press fingerprint or enter password to unlock</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="1137"/> <location filename="../src/mainwindow.cpp" line="1203"/>
<source>Verify voiceprint or enter password to unlock</source> <source>Verify voiceprint or enter password to unlock</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="1142"/> <location filename="../src/mainwindow.cpp" line="1208"/>
<source>Verify finger vein or enter password to unlock</source> <source>Verify finger vein or enter password to unlock</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="1147"/> <location filename="../src/mainwindow.cpp" line="1213"/>
<source>Verify iris or enter password to unlock</source> <source>Verify iris or enter password to unlock</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="1152"/> <location filename="../src/mainwindow.cpp" line="1218"/>
<source>Use the bound wechat scanning code or enter the password to unlock</source> <source>Use the bound wechat scanning code or enter the password to unlock</source>
<translation>使</translation> <translation>使</translation>
</message> </message>
@ -344,10 +353,10 @@
<translation type="vanished">使</translation> <translation type="vanished">使</translation>
</message> </message>
<message> <message>
<location filename="../src/mainwindow.cpp" line="581"/> <location filename="../src/mainwindow.cpp" line="623"/>
<location filename="../src/mainwindow.cpp" line="585"/> <location filename="../src/mainwindow.cpp" line="627"/>
<location filename="../src/mainwindow.cpp" line="589"/> <location filename="../src/mainwindow.cpp" line="631"/>
<location filename="../src/mainwindow.cpp" line="593"/> <location filename="../src/mainwindow.cpp" line="635"/>
<source>Account locked,</source> <source>Account locked,</source>
<translation></translation> <translation></translation>
</message> </message>
@ -359,17 +368,17 @@
<context> <context>
<name>PolkitListener</name> <name>PolkitListener</name>
<message> <message>
<location filename="../src/PolkitListener.cpp" line="59"/> <location filename="../src/PolkitListener.cpp" line="88"/>
<source>Another client is already authenticating, please try again later.</source> <source>Another client is already authenticating, please try again later.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/PolkitListener.cpp" line="226"/> <location filename="../src/PolkitListener.cpp" line="257"/>
<source>Authentication failure, please try again.</source> <source>Authentication failure, please try again.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../src/PolkitListener.cpp" line="233"/> <location filename="../src/PolkitListener.cpp" line="264"/>
<source>Password input error!</source> <source>Password input error!</source>
<translation></translation> <translation></translation>
</message> </message>

View File

@ -73,6 +73,7 @@ int main(int argc, char *argv[])
BioDevices devices; BioDevices devices;
devices.setIsShowHotPlug(true); devices.setIsShowHotPlug(true);
devices.setUId(getuid());
agent.exec(); agent.exec();
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -35,6 +35,7 @@
#include "PolkitListener.h" #include "PolkitListener.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "generic.h" #include "generic.h"
#include <libkysysinfo.h>
PolkitListener::PolkitListener(QObject *parent) PolkitListener::PolkitListener(QObject *parent)
: Listener(parent), : Listener(parent),
@ -42,12 +43,40 @@ PolkitListener::PolkitListener(QObject *parent)
currentIdentity(0), currentIdentity(0),
mainWindow(nullptr) mainWindow(nullptr)
{ {
m_isSupportTableMode = isSupportTableMode();
m_isMavis = isMavis();
qDebug()<<"isSupportTableMode:"<<m_isSupportTableMode;
} }
PolkitListener::~PolkitListener() PolkitListener::~PolkitListener()
{ {
} }
bool PolkitListener::isMavis()
{
char *prjName = kdk_system_get_projectName();
if (prjName) {
QString strFeature = QString(prjName);
free(prjName);
if (!strFeature.isEmpty()) {
if(strFeature == "V10SP1-edu"){
m_isSupportTableMode = true;
return true;
}
}
}
return false;
}
bool PolkitListener::isSupportTableMode()
{
unsigned int nFeature = kdk_system_get_productFeatures();
if (nFeature&0x02) { // 支持平板模式
return true;
}
return false;
}
/* initiateAuthentication message from polkit */ /* initiateAuthentication message from polkit */
void PolkitListener::initiateAuthentication( void PolkitListener::initiateAuthentication(
const QString &actionId, const QString &message, const QString &actionId, const QString &message,
@ -119,8 +148,10 @@ void PolkitListener::initiateAuthentication(
// XAtomHelper::getInstance()->setWindowMotifHint(mainWindow->winId(), hints); // XAtomHelper::getInstance()->setWindowMotifHint(mainWindow->winId(), hints);
mainWindow->setWindowFlags(Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint); mainWindow->setWindowFlags(Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint);
mainWindow->setIcon(iconName); mainWindow->setIcon(iconName);
mainWindow->setCurProject(m_isMavis);
mainWindow->setHeader(message); mainWindow->setHeader(message);
mainWindow->setUsers(usersList); mainWindow->setUsers(usersList);
mainWindow->setEditInputMethod(m_isSupportTableMode);
/* /*
mainWindow->setDetails(subjectPid, callerPid, mainWindow->setDetails(subjectPid, callerPid,
actionDesc.actionId(), actionDesc.actionId(),

View File

@ -32,6 +32,10 @@ public:
PolkitListener(QObject *parent = 0); PolkitListener(QObject *parent = 0);
virtual ~PolkitListener(); virtual ~PolkitListener();
private:
bool isSupportTableMode();
bool isMavis();
public slots: public slots:
void initiateAuthentication(const QString &actionId, void initiateAuthentication(const QString &actionId,
const QString &message, const QString &message,
@ -58,6 +62,8 @@ private:
QString cookie; QString cookie;
MainWindow *mainWindow; MainWindow *mainWindow;
bool unacknowledged_messages = false; bool unacknowledged_messages = false;
bool m_isSupportTableMode = false;
bool m_isMavis = false;
private slots: private slots:

View File

@ -0,0 +1,44 @@
#include "kalabel.h"
KALabel::KALabel(QWidget *parent)
: QLabel(parent)
{
m_strText = "";
}
KALabel::KALabel(QString strText, QWidget *parent)
: QLabel(strText, parent)
{
m_strText = strText;
}
void KALabel::setText(const QString &strText)
{
m_strText = strText;
QLabel::setText(strText);
}
void KALabel::paintEvent(QPaintEvent *event)
{
QString strEText = getElidedText(font(), width() ,m_strText);
if (strEText != m_strText) {
QLabel::setText(strEText);
setToolTip(m_strText);
} else {
QLabel::setText(m_strText);
setToolTip("");
}
QLabel::paintEvent(event);
}
QString KALabel::getElidedText(QFont font,int width,QString strInfo)
{
QFontMetrics fontMetrics(font);
//如果当前字体下,字符串长度大于指定宽度
if(fontMetrics.width(strInfo) > width)
{
strInfo= QFontMetrics(font).elidedText(strInfo, Qt::ElideRight, width);
}
return strInfo;
}

View File

@ -0,0 +1,23 @@
#ifndef KALABEL_H
#define KALABEL_H
#include <QLabel>
class KALabel : public QLabel
{
Q_OBJECT
public:
KALabel(QWidget *parent = nullptr);
KALabel(QString strText, QWidget *parent = nullptr);
QString getElidedText(QFont font,int width,QString strInfo);
public slots:
void setText(const QString &);
protected:
void paintEvent(QPaintEvent *event);
private:
QString m_strText;
};
#endif // KALABEL_H

View File

@ -35,6 +35,7 @@
#include <pwd.h> #include <pwd.h>
#include <libintl.h> #include <libintl.h>
#include <locale.h> #include <locale.h>
#include <QMatrix>
#include "bioauthwidget.h" #include "bioauthwidget.h"
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QAction> #include <QAction>
@ -54,10 +55,10 @@ MainWindow::MainWindow(QWidget *parent) :
authMode(UNDEFINED), authMode(UNDEFINED),
useDoubleAuth(false), useDoubleAuth(false),
m_timer(nullptr), m_timer(nullptr),
w_timer(nullptr),
isLockingFlg(false), isLockingFlg(false),
m_nCurLockMin(0), m_nCurLockMin(0),
isbioSuccess(false), isbioSuccess(false)
useFirstDevice(false)
{ {
ui->setupUi(this); ui->setupUi(this);
setWindowTitle(tr("Authentication")); setWindowTitle(tr("Authentication"));
@ -87,7 +88,7 @@ MainWindow::MainWindow(QWidget *parent) :
// headerLayout->addWidget(closeBtn); // headerLayout->addWidget(closeBtn);
// 登录选项 // 登录选项
m_labelTip = new QLabel(); m_labelTip = new KALabel();
m_labelTip->setText(""); m_labelTip->setText("");
m_labelTip->hide(); m_labelTip->hide();
m_loginOptsWidget = new LoginOptionsWidget(); m_loginOptsWidget = new LoginOptionsWidget();
@ -98,7 +99,6 @@ MainWindow::MainWindow(QWidget *parent) :
maxFailedTimes = bioDevices.getFailedTimes(); maxFailedTimes = bioDevices.getFailedTimes();
isHiddenSwitchButton = bioDevices.GetHiddenSwitchButton(); isHiddenSwitchButton = bioDevices.GetHiddenSwitchButton();
useFirstDevice = bioDevices.getUseFirstDevice();
connect(m_loginOptsWidget, &LoginOptionsWidget::optionSelected, connect(m_loginOptsWidget, &LoginOptionsWidget::optionSelected,
this, [&](unsigned uCurLoginOptType, const DeviceInfoPtr &deviceInfo){ this, [&](unsigned uCurLoginOptType, const DeviceInfoPtr &deviceInfo){
@ -143,7 +143,13 @@ MainWindow::MainWindow(QWidget *parent) :
emit switchToBiometric(); emit switchToBiometric();
authMode = UNDEFINED; authMode = UNDEFINED;
} else { } else {
if (nStatus >= 2) { if (nStatus == 5 && m_deviceInfo) {
if(w_timer && w_timer->isActive())
w_timer->stop();
QImage imgFailed;
m_loginOptsWidget->setFaceImg(imgFailed, 2);
return;
} else if (nStatus >= 2 && nStatus != 5)if (nStatus >= 2) {
if (m_deviceInfo) { if (m_deviceInfo) {
uid_t curUid = getUid(userName); uid_t curUid = getUid(userName);
if(m_failMap.contains(curUid) && m_failMap[curUid].contains(m_deviceInfo->device_id)){ if(m_failMap.contains(curUid) && m_failMap[curUid].contains(m_deviceInfo->device_id)){
@ -157,6 +163,7 @@ MainWindow::MainWindow(QWidget *parent) :
m_loginOptsWidget->setFaceImg(imgFailed, 1); m_loginOptsWidget->setFaceImg(imgFailed, 1);
} }
if(m_failMap[curUid][m_deviceInfo->device_id] >= maxFailedTimes){ if(m_failMap[curUid][m_deviceInfo->device_id] >= maxFailedTimes){
no_changes = true;
if (m_deviceInfo->biotype == REMOTE_QRCODE_TYPE) { if (m_deviceInfo->biotype == REMOTE_QRCODE_TYPE) {
setLoginTypeTip(tr("Failed to verify %1, please enter password to unlock").arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype))); setLoginTypeTip(tr("Failed to verify %1, please enter password to unlock").arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype)));
QImage nullImage; QImage nullImage;
@ -168,6 +175,7 @@ MainWindow::MainWindow(QWidget *parent) :
useDoubleAuth = false; useDoubleAuth = false;
return ; return ;
} }
no_changes = false;
setLoginTypeTip(tr("Failed to verify %1, you still have %2 verification opportunities") setLoginTypeTip(tr("Failed to verify %1, you still have %2 verification opportunities")
.arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype)) .arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype))
.arg(maxFailedTimes-m_failMap[curUid][m_deviceInfo->device_id])); .arg(maxFailedTimes-m_failMap[curUid][m_deviceInfo->device_id]));
@ -180,7 +188,7 @@ MainWindow::MainWindow(QWidget *parent) :
} }
if (m_uCurLoginOptType == LOGINOPT_TYPE_QRCODE && nStatus == 1) { if (m_uCurLoginOptType == LOGINOPT_TYPE_QRCODE && nStatus == 1) {
m_isNetworkErr = true; m_isNetworkErr = true;
m_loginOptsWidget->setQRCodeMsg(tr("NET Exception")); m_loginOptsWidget->setQRCodeMsg(tr("Abnormal network"));
startBioAuth(10000); startBioAuth(10000);
} else { } else {
startBioAuth(); startBioAuth();
@ -221,6 +229,16 @@ MainWindow::MainWindow(QWidget *parent) :
fontSize = settings->get("system-font-size").toInt(); fontSize = settings->get("system-font-size").toInt();
connect(settings, &QGSettings::changed, connect(settings, &QGSettings::changed,
this, &MainWindow::onConfigurationChanged); this, &MainWindow::onConfigurationChanged);
QDBusInterface *interfaceScreensaver = new QDBusInterface(
"org.ukui.ScreenSaver",
"/",
"org.ukui.ScreenSaver",
QDBusConnection::sessionBus());
connect(interfaceScreensaver, SIGNAL(lock()),
this, SLOT(onLockStatus()));
connect(interfaceScreensaver, SIGNAL(unlock()),
this, SLOT(onUnlockStatus()));
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
@ -337,6 +355,7 @@ void MainWindow::on_cmbUsers_currentTextChanged(const QString &userName)
m_deviceInfo = DeviceInfoPtr(); m_deviceInfo = DeviceInfoPtr();
ui->lblMessage->clear(); ui->lblMessage->clear();
ui->lblMessage->setToolTip(""); ui->lblMessage->setToolTip("");
setMessage("");
isLockingFlg = false; isLockingFlg = false;
emit userChanged(this->userName); emit userChanged(this->userName);
} }
@ -390,6 +409,19 @@ void MainWindow::on_btnAuth_clicked()
on_lePassword_returnPressed(); on_lePassword_returnPressed();
} }
void MainWindow::onLockStatus()
{
//m_loginOptsWidget->stopAuth();
m_loginOptsWidget->lockStatusChanged(true);
}
void MainWindow::onUnlockStatus()
{
//m_loginOptsWidget->readDevicesInfo();
m_loginOptsWidget->lockStatusChanged(false);
startBioAuth();
}
/*** pagePassword ***/ /*** pagePassword ***/
void MainWindow::editIcon() void MainWindow::editIcon()
{ {
@ -414,6 +446,17 @@ void MainWindow::on_lePassword_returnPressed()
{ {
emit accept(ui->lePassword->text()); emit accept(ui->lePassword->text());
ui->btnAuth->hide(); ui->btnAuth->hide();
ui->btnLoading->show();
if(!w_timer)
{
w_timer = new QTimer(this);
w_timer->setInterval(150);
connect(w_timer, &QTimer::timeout, this, &MainWindow::updatePixmap);
}
m_waitingPixmap = QIcon::fromTheme("ukui-loading-0-symbolic").pixmap(24, 24);
ui->btnLoading->setIcon(QIcon(m_waitingPixmap));
w_timer->start();
// switchWidget(UNDEFINED); // switchWidget(UNDEFINED);
// setMessage(tr("in authentication, please wait...")); // setMessage(tr("in authentication, please wait..."));
} }
@ -469,6 +512,10 @@ void MainWindow::setIcon(const QString &iconName)
void MainWindow::setHeader(const QString &text) void MainWindow::setHeader(const QString &text)
{ {
if(is_Mavis)
ui->lblHeader->setText(tr("This operation requires the administrator's authorization. "
"Please enter your password to allow this operation."));
else
ui->lblHeader->setText(text); ui->lblHeader->setText(text);
ui->lblHeader->adjustSize(); ui->lblHeader->adjustSize();
ui->lblHeader->height(); ui->lblHeader->height();
@ -566,17 +613,17 @@ QString MainWindow::check_is_pam_message(QString text)
textdomain("Linux-PAM"); textdomain("Linux-PAM");
char* str; char* str;
QString strTrans = ""; QString strTrans = "";
QByteArray ba = text.toLatin1(); // must QByteArray ba = text.toLocal8Bit(); // must
str=ba.data(); str=ba.data();
char l_str[1024];
int a,b; int a,b;
//兼容旧版本翻译,以及适配新版本翻译 //兼容旧版本翻译,以及适配新版本翻译
if(text.contains("attemps",Qt::CaseSensitive) && sscanf(str,"Authenticated failed, %d login attemps left",&a)) if(text.contains("attemps",Qt::CaseSensitive) && sscanf(str,"Authenticated failed, %d login attemps left",&a))
sprintf(str,_("Authenticated failed, %d login attemps left"),a); snprintf(l_str,1024,_("Authenticated failed, %d login attemps left"),a);
else if(text.contains("attempts",Qt::CaseSensitive) && sscanf(str,"Authenticated failed, %d login attempts left",&a)) else if(text.contains("attempts",Qt::CaseSensitive) && sscanf(str,"Authenticated failed, %d login attempts left",&a))
sprintf(str,_("Authenticated failed, %d login attempts left"),a); snprintf(l_str,1024,_("Authenticated failed, %d login attempts left"),a);
else if(text.contains("attempt",Qt::CaseSensitive) && sscanf(str,"Authenticated failed, %d login attempt left",&a)) else if(text.contains("attempt",Qt::CaseSensitive) && sscanf(str,"Authenticated failed, %d login attempt left",&a))
sprintf(str,_("Authenticated failed, %d login attempt left"),a); snprintf(l_str,1024,_("Authenticated failed, %d login attempt left"),a);
else if(text.contains("days",Qt::CaseSensitive) && sscanf(str,"Account locked, %d days left",&a)){ else if(text.contains("days",Qt::CaseSensitive) && sscanf(str,"Account locked, %d days left",&a)){
strTrans = tr("Account locked,") + QString("%1 ").arg(a) + tr("days left"); strTrans = tr("Account locked,") + QString("%1 ").arg(a) + tr("days left");
return strTrans; return strTrans;
@ -594,12 +641,11 @@ QString MainWindow::check_is_pam_message(QString text)
return strTrans; return strTrans;
} }
else{ else{
str = _(str); return _(str);
} }
qDebug()<<"str = "<<str; qDebug()<<"l_str = "<<l_str;
return QString(str); return QString(l_str);
} }
void MainWindow::setMessage(const QString &text,situation situat) void MainWindow::setMessage(const QString &text,situation situat)
@ -609,8 +655,8 @@ void MainWindow::setMessage(const QString &text,situation situat)
QPalette pe; QPalette pe;
pe.setColor(QPalette::WindowText,Qt::red); pe.setColor(QPalette::WindowText,Qt::red);
ui->lblMessage->setPalette(pe); ui->lblMessage->setPalette(pe);
ui->lePassword->setStyleSheet("QLineEdit{background-color: palette(Button);" // ui->lePassword->setStyleSheet("QLineEdit{background-color: palette(Button);"
"lineedit-password-character:42;border-radius: 6px;border: 1px solid #F3222D;}"); // "border-radius: 6px;border: 1px solid #F3222D;}");
}else if(situat == TRUE){ }else if(situat == TRUE){
QColor color = palette().color(QPalette::WindowText); QColor color = palette().color(QPalette::WindowText);
QPalette pal(this->palette()); QPalette pal(this->palette());
@ -649,12 +695,14 @@ void MainWindow::setAuthResult(bool result, const QString &text)
message = tr("Authentication failed, please try again."); message = tr("Authentication failed, please try again.");
} }
if(authMode == PASSWORD) if(authMode == PASSWORD) {
setMessage(message,ERROR); switchWidget(PASSWORD);
//setMessage(message,ERROR);
}
else if(authMode == BIOMETRIC) else if(authMode == BIOMETRIC)
setMessage(message,ERROR); setMessage(message,ERROR);
switchWidget(PASSWORD);
} }
void MainWindow::clearEdit() void MainWindow::clearEdit()
@ -705,6 +753,7 @@ void MainWindow::switchAuthMode(Mode mode)
break; break;
case BIOMETRIC: case BIOMETRIC:
{ {
authMode = mode;
qDebug() << "switch to biometric"; qDebug() << "switch to biometric";
if (m_deviceInfo) { if (m_deviceInfo) {
if (!m_loginOptsWidget->findDeviceById(m_deviceInfo->device_id) if (!m_loginOptsWidget->findDeviceById(m_deviceInfo->device_id)
@ -712,10 +761,10 @@ void MainWindow::switchAuthMode(Mode mode)
m_deviceInfo = DeviceInfoPtr(); m_deviceInfo = DeviceInfoPtr();
} }
} }
if(authMode == PASSWORD) { /*if(authMode == PASSWORD) {
emit accept(BIOMETRIC_IGNORE); emit accept(BIOMETRIC_IGNORE);
return; return;
}else if(!enableBioAuth){ }else */if(!enableBioAuth){
qDebug() << "It doesn't meet the condition for enabling biometric authentication, switch to password."; qDebug() << "It doesn't meet the condition for enabling biometric authentication, switch to password.";
emit accept(BIOMETRIC_IGNORE); emit accept(BIOMETRIC_IGNORE);
return; return;
@ -725,19 +774,13 @@ void MainWindow::switchAuthMode(Mode mode)
if(strDeviceName.isEmpty() && !m_deviceInfo) if(strDeviceName.isEmpty() && !m_deviceInfo)
{ {
qDebug() << "No default device"; qDebug() << "No default device";
if(useFirstDevice == true){
m_deviceInfo = m_loginOptsWidget->getFirstDevInfo();
} else {
emit accept(BIOMETRIC_IGNORE); emit accept(BIOMETRIC_IGNORE);
return; return;
} }
}
//第一次,获取默认设备的设备信息,之后使用的则是从设备选择窗口传出的设备信息 //第一次,获取默认设备的设备信息,之后使用的则是从设备选择窗口传出的设备信息
if(!m_deviceInfo) if(!m_deviceInfo)
{ {
m_deviceInfo = m_loginOptsWidget->findDeviceByName(strDeviceName); m_deviceInfo = m_loginOptsWidget->findDeviceByName(strDeviceName);
if (!m_deviceInfo)
m_deviceInfo = m_loginOptsWidget->getFirstDevInfo();
} }
if(!m_deviceInfo){ if(!m_deviceInfo){
emit accept(BIOMETRIC_IGNORE); emit accept(BIOMETRIC_IGNORE);
@ -751,7 +794,7 @@ void MainWindow::switchAuthMode(Mode mode)
startBioAuth(); startBioAuth();
emit accept(BIOMETRIC_IGNORE); emit accept(BIOMETRIC_IGNORE);
return; return;
} else if(authMode == UNDEFINED){ } /*else if(authMode == UNDEFINED){
authMode = BIOMETRIC; authMode = BIOMETRIC;
if(enableBioAuth) { if(enableBioAuth) {
@ -787,13 +830,13 @@ void MainWindow::switchAuthMode(Mode mode)
startBioAuth(); startBioAuth();
emit accept(BIOMETRIC_IGNORE); emit accept(BIOMETRIC_IGNORE);
return; return;
} else { } else {*/
/* pass biometric's pam module if there are not available devices */ /* pass biometric's pam module if there are not available devices */
qDebug() << "It doesn't meet the condition for enabling biometric authentication, switch to password."; // qDebug() << "It doesn't meet the condition for enabling biometric authentication, switch to password.";
emit accept(BIOMETRIC_IGNORE); // emit accept(BIOMETRIC_IGNORE);
return; // return;
} // }
} // }
} }
break; break;
default: default:
@ -831,6 +874,7 @@ void MainWindow::switchWidget(Mode mode)
{ {
ui->widgetPasswdAuth->hide(); ui->widgetPasswdAuth->hide();
ui->btnAuth->hide(); ui->btnAuth->hide();
ui->btnLoading->hide();
ui->btnAuth->setText(tr("Authenticate")); ui->btnAuth->setText(tr("Authenticate"));
ui->btnAuth->adjustSize(); ui->btnAuth->adjustSize();
ui->btnBioAuth->setText(tr("Biometric")); ui->btnBioAuth->setText(tr("Biometric"));
@ -838,7 +882,14 @@ void MainWindow::switchWidget(Mode mode)
ui->btnCancel->setText(tr("Cancel")); ui->btnCancel->setText(tr("Cancel"));
ui->btnCancel->adjustSize(); ui->btnCancel->adjustSize();
ui->returnButton->setText(tr("Use password")); ui->returnButton->setText(tr("Use password"));
ui->btnLoading->setDisabled(true);
ui->returnButton->adjustSize(); ui->returnButton->adjustSize();
if(is_Mavis){
ui->cmbUsers->setFixedHeight(48);
ui->lePassword->setFixedHeight(48);
ui->btnAuth->setFixedHeight(48);
ui->btnCancel->setFixedHeight(48);
}
switch(mode){ switch(mode){
case PASSWORD: case PASSWORD:
{ {
@ -878,15 +929,17 @@ void MainWindow::switchWidget(Mode mode)
+ ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height() + ui->cmbUsers->height() + ui->lePassword->height() + ui->lblMessage->height()
+ ui->btnAuth->height(); + ui->btnAuth->height();
} }
if (m_loginOptsWidget->isHidden()) {
height -= 20 ;
}
unsigned uOptsWidgetHeight = m_loginOptsWidget->height(); unsigned uOptsWidgetHeight = m_loginOptsWidget->height();
if (m_loginOptsWidget->isHidden()) { if (m_loginOptsWidget->isHidden()) {
uOptsWidgetHeight = 0; uOptsWidgetHeight = 0;
height -= 20 ; height -= 20 ;
} }
ui->lblContent->adjustSize(); setMinimumHeight(height + uOptsWidgetHeight + 10);
ui->lblHeader->adjustSize(); setMaximumHeight(height + uOptsWidgetHeight + 10);
setMinimumHeight(height + uOptsWidgetHeight);
setMaximumHeight(height + uOptsWidgetHeight);
//m_loginOptsWidget->updateUIStatus(); //m_loginOptsWidget->updateUIStatus();
ui->btnBioAuth->setStyleSheet("QPushButton{font-size:14px;}QPushButton:hover{border:none;color:#3E6CE5;}QPushButton:pressed{border:none;}"); ui->btnBioAuth->setStyleSheet("QPushButton{font-size:14px;}QPushButton:hover{border:none;color:#3E6CE5;}QPushButton:pressed{border:none;}");
ui->btnBioAuth->setFlat(true); ui->btnBioAuth->setFlat(true);
@ -895,10 +948,19 @@ void MainWindow::switchWidget(Mode mode)
ui->btnBioAuth->adjustSize(); ui->btnBioAuth->adjustSize();
ui->widgetPasswdAuth->show(); ui->widgetPasswdAuth->show();
ui->lePassword->setFocus(); ui->lePassword->setFocus();
ui->lePassword->setContextMenuPolicy(Qt::NoContextMenu); //禁用右键菜单 //ui->lePassword->setAttribute(Qt::WA_InputMethodEnabled, false);
ui->lePassword->setAttribute(Qt::WA_InputMethodEnabled, false); if (m_modeButton && m_modeButton->isShowPwd()) {
ui->lePassword->setEchoMode(QLineEdit::Normal);
} else {
ui->lePassword->setEchoMode(QLineEdit::Password); ui->lePassword->setEchoMode(QLineEdit::Password);
}
ui->btnAuth->show(); ui->btnAuth->show();
ui->btnLoading->hide();
ui->lePassword->setDisabled(false);
if(w_timer && w_timer->isActive())
{
w_timer->stop();
}
ui->btnCancel->show(); ui->btnCancel->show();
//ui->lblContent->show(); //ui->lblContent->show();
ui->returnButton->hide(); ui->returnButton->hide();
@ -909,11 +971,10 @@ void MainWindow::switchWidget(Mode mode)
case BIOMETRIC: case BIOMETRIC:
setMinimumWidth(420); setMinimumWidth(420);
setMaximumWidth(420); setMaximumWidth(420);
if(bioDevices.count()<1||bioDevices.count()==1){ if(m_loginOptsWidget->getLoginOptCount() <= 1){
setMinimumHeight(392+ui->cmbUsers->height()+ui->lblHeader->height()); setMinimumHeight(392+ui->cmbUsers->height()+ui->lblHeader->height());
setMaximumHeight(392+ui->cmbUsers->height()+ui->lblHeader->height()); setMaximumHeight(392+ui->cmbUsers->height()+ui->lblHeader->height());
} } else {
if(bioDevices.count()>1){
setMinimumHeight(482+ui->cmbUsers->height()+ui->lblHeader->height()); setMinimumHeight(482+ui->cmbUsers->height()+ui->lblHeader->height());
setMaximumHeight(482+ui->cmbUsers->height()+ui->lblHeader->height()); setMaximumHeight(482+ui->cmbUsers->height()+ui->lblHeader->height());
} }
@ -934,7 +995,7 @@ void MainWindow::switchWidget(Mode mode)
default: default:
break; break;
} }
adjustSize(); // adjustSize();
} }
void MainWindow::unlock_countdown() void MainWindow::unlock_countdown()
@ -1107,6 +1168,7 @@ void MainWindow::switchLoginOptType(unsigned uLoginOptType)
QImage imgFailed; QImage imgFailed;
m_loginOptsWidget->setFaceImg(imgFailed, 1); m_loginOptsWidget->setFaceImg(imgFailed, 1);
} }
no_changes = true;
if (m_deviceInfo->biotype == REMOTE_QRCODE_TYPE) { if (m_deviceInfo->biotype == REMOTE_QRCODE_TYPE) {
setLoginTypeTip(tr("Failed to verify %1, please enter password to unlock").arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype))); setLoginTypeTip(tr("Failed to verify %1, please enter password to unlock").arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype)));
} else { } else {
@ -1114,6 +1176,7 @@ void MainWindow::switchLoginOptType(unsigned uLoginOptType)
} }
m_loginOptsWidget->setDeviceDisable(m_deviceInfo->device_id, true); m_loginOptsWidget->setDeviceDisable(m_deviceInfo->device_id, true);
} else { } else {
no_changes = false;
if (uLoginOptType != m_uCurLoginOptType || (m_deviceInfo && m_deviceInfo->device_id != m_nLastDeviceId)) { if (uLoginOptType != m_uCurLoginOptType || (m_deviceInfo && m_deviceInfo->device_id != m_nLastDeviceId)) {
switch(uLoginOptType) { switch(uLoginOptType) {
case LOGINOPT_TYPE_PASSWORD: case LOGINOPT_TYPE_PASSWORD:
@ -1171,22 +1234,21 @@ void MainWindow::setLoginTypeTip(QString strLoginTypeTip)
if (m_strLoginTypeTip.isEmpty()) { if (m_strLoginTypeTip.isEmpty()) {
m_labelTip->hide(); m_labelTip->hide();
} else { } else {
QFontMetrics font(m_labelTip->font());
//返回字符串末尾带省略号的字符串
QString strDisplay = font.elidedText(m_strLoginTypeTip, Qt::ElideRight, m_labelTip->width()-8);
QPalette pe; QPalette pe;
pe.setColor(QPalette::WindowText,Qt::blue); if(no_changes)
pe.setColor(QPalette::WindowText,Qt::red);
else
pe.setColor(QPalette::WindowText,QColor(55, 144, 250, 255));
m_labelTip->setPalette(pe); m_labelTip->setPalette(pe);
m_labelTip->setText(strDisplay); m_labelTip->setText(m_strLoginTypeTip);
m_labelTip->setToolTip(m_strLoginTypeTip);
m_labelTip->show(); m_labelTip->show();
} }
} }
void MainWindow::startBioAuthDelay() void MainWindow::startBioAuthDelay()
{ {
m_loginOptsWidget->startAuth(m_deviceInfo, getUid(userName));
if (m_deviceInfo) { if (m_deviceInfo) {
m_loginOptsWidget->startAuth(m_deviceInfo, getUid(userName));
switchLoginOptType(m_loginOptsWidget->convertDeviceType(m_deviceInfo->biotype)); switchLoginOptType(m_loginOptsWidget->convertDeviceType(m_deviceInfo->biotype));
} else { } else {
switchLoginOptType(LOGINOPT_TYPE_PASSWORD); switchLoginOptType(LOGINOPT_TYPE_PASSWORD);
@ -1211,6 +1273,17 @@ void MainWindow::onUpdateBioAuthMsg(QString strMsg)
setMessage(strMsg, TRUE); setMessage(strMsg, TRUE);
} }
void MainWindow::updatePixmap()
{
ui->btnAuth->hide();
ui->btnLoading->show();
ui->lePassword->setDisabled(true);
QMatrix matrix;
matrix.rotate(90.0);
m_waitingPixmap = m_waitingPixmap.transformed(matrix, Qt::FastTransformation);
ui->btnLoading->setIcon(m_waitingPixmap);
}
void MainWindow::onUpdateWndSize(unsigned uLoginOptType, unsigned uLoginOptSize) void MainWindow::onUpdateWndSize(unsigned uLoginOptType, unsigned uLoginOptSize)
{ {
ui->lblContent->hide(); ui->lblContent->hide();
@ -1230,7 +1303,7 @@ void MainWindow::onUpdateWndSize(unsigned uLoginOptType, unsigned uLoginOptSize)
uOptsWidgetHeight = m_loginOptsWidget->height() + 10 ; uOptsWidgetHeight = m_loginOptsWidget->height() + 10 ;
} }
// ui->lblContent->adjustSize(); // ui->lblContent->adjustSize();
ui->lblHeader->adjustSize(); // ui->lblHeader->adjustSize();
int height; int height;
if(fontSize = 10){ if(fontSize = 10){
height = 120 + ui->lblHeader->height() /*+ ui->lblContent->height()*/ height = 120 + ui->lblHeader->height() /*+ ui->lblContent->height()*/
@ -1264,4 +1337,19 @@ void MainWindow::onUpdateWndSize(unsigned uLoginOptType, unsigned uLoginOptSize)
setMaximumHeight(height + uOptsWidgetHeight); setMaximumHeight(height + uOptsWidgetHeight);
} }
void MainWindow::setEditInputMethod(bool bEnable)
{
qDebug()<<"setEditInputMethod:"<<bEnable;
if (bEnable) {
ui->lePassword->setAttribute(Qt::WA_InputMethodEnabled, true);
} else {
ui->lePassword->setAttribute(Qt::WA_InputMethodEnabled, false);
}
}
void MainWindow::setCurProject(bool isMavis)
{
is_Mavis = isMavis;
}
/*** end of private member ***/ /*** end of private member ***/

View File

@ -30,6 +30,7 @@
#include "bioauthwidget.h" #include "bioauthwidget.h"
#include "loginoptionswidget.h" #include "loginoptionswidget.h"
#include "modeButton.h" #include "modeButton.h"
#include "kalabel.h"
namespace Ui { namespace Ui {
class MainWindow; class MainWindow;
} }
@ -61,6 +62,8 @@ public:
void stopDoubleAuth(); void stopDoubleAuth();
QString check_is_pam_message(QString text); QString check_is_pam_message(QString text);
void switchLoginOptType(unsigned uLoginOptType); void switchLoginOptType(unsigned uLoginOptType);
void setEditInputMethod(bool bEnable);
void setCurProject(bool isMavis);
private: private:
uid_t getUid(const QString &userName); uid_t getUid(const QString &userName);
@ -75,6 +78,8 @@ private:
void unlock_countdown(); void unlock_countdown();
void editIcon(); void editIcon();
void setLoginTypeTip(QString strLoginTypeTip); void setLoginTypeTip(QString strLoginTypeTip);
void setMavisSheel();
void updatePixmap();
public slots: public slots:
void onUpdateBioAuthMsg(QString strMsg); void onUpdateBioAuthMsg(QString strMsg);
@ -91,6 +96,8 @@ private slots:
void restart_bio_identify(); void restart_bio_identify();
void startBioAuthDelay(); void startBioAuthDelay();
void onConfigurationChanged(QString key); void onConfigurationChanged(QString key);
void onLockStatus();
void onUnlockStatus();
signals: signals:
void accept(const QString &text); void accept(const QString &text);
@ -123,13 +130,12 @@ private:
bool isLockingFlg; //判断当前是否正在锁定倒计时 bool isLockingFlg; //判断当前是否正在锁定倒计时
int m_nCurLockMin; //当前锁定的分钟数 int m_nCurLockMin; //当前锁定的分钟数
// 登录选项 // 登录选项
QLabel *m_labelTip = nullptr; KALabel *m_labelTip = nullptr;
LoginOptionsWidget *m_loginOptsWidget = nullptr; LoginOptionsWidget *m_loginOptsWidget = nullptr;
unsigned m_uCurLoginOptType = LOGINOPT_TYPE_PASSWORD; // 当前登录验证方式 unsigned m_uCurLoginOptType = LOGINOPT_TYPE_PASSWORD; // 当前登录验证方式
QString m_strLoginTypeTip = ""; QString m_strLoginTypeTip = "";
QTimer *m_bioTimer = nullptr; QTimer *m_bioTimer = nullptr;
DeviceInfoPtr m_deviceInfo = nullptr; DeviceInfoPtr m_deviceInfo = nullptr;
bool useFirstDevice;
bool m_isNetworkErr = false; bool m_isNetworkErr = false;
//标题栏 //标题栏
QHBoxLayout *headerLayout; QHBoxLayout *headerLayout;
@ -142,6 +148,12 @@ private:
QString app_IconName; QString app_IconName;
int m_nLastDeviceId = -1; int m_nLastDeviceId = -1;
bool no_changes = false;
bool is_Mavis = false;
QTimer *w_timer;
QPixmap m_waitingPixmap;
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>459</width> <width>459</width>
<height>419</height> <height>432</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -96,6 +96,9 @@
</item> </item>
<item row="5" column="1"> <item row="5" column="1">
<widget class="QComboBox" name="cmbUsers"> <widget class="QComboBox" name="cmbUsers">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
@ -172,7 +175,7 @@
</widget> </widget>
</item> </item>
<item row="2" column="0" colspan="2"> <item row="2" column="0" colspan="2">
<widget class="QLabel" name="lblMessage"> <widget class="KALabel" name="lblMessage">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
@ -351,6 +354,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="btnLoading">
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="returnButton"> <widget class="QPushButton" name="returnButton">
<property name="styleSheet"> <property name="styleSheet">
@ -365,6 +378,13 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>KALabel</class>
<extends>QLabel</extends>
<header>./src/kalabel.h</header>
</customwidget>
</customwidgets>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

View File

@ -147,3 +147,8 @@ QPixmap ModeButton::drawSymbolicColoredPixmap(QPixmap &source, QString cgColor)
} }
return QPixmap::fromImage(img); return QPixmap::fromImage(img);
} }
bool ModeButton::isShowPwd()
{
return pwdShow;
}

View File

@ -17,6 +17,7 @@ public:
QPixmap drawSymbolicColoredPixmap(QPixmap &source, QString cgColor); QPixmap drawSymbolicColoredPixmap(QPixmap &source, QString cgColor);
void initUI(); void initUI();
void setModeIcon(); void setModeIcon();
bool isShowPwd();
protected: protected:
bool eventFilter(QObject *obj, QEvent *event) override; //事件过滤 bool eventFilter(QObject *obj, QEvent *event) override; //事件过滤

View File

@ -358,13 +358,19 @@ pam_modutil_read(int fd, char *buffer, int count)
void get_tally(uid_t uid, int *tfile, struct tallylog *tally) void get_tally(uid_t uid, int *tfile, struct tallylog *tally)
{ {
char filename[50]={0}; char filename[50]={0};
sprintf(filename,"%s","/tmp/.tallylog"); sprintf(filename,"/tmp/.tallylog.d/.%d",uid);
fprintf(stderr,"new_filename = :%s \n",filename);
void *void_tally = tally; void *void_tally = tally;
if ((*tfile = open(filename, O_RDONLY)) == -1){
fprintf(stderr, "lseek tallylog failed,Re-open the new file, uid = %d \n",uid);
sprintf(filename,"/tmp/.tallylog");
fprintf(stderr,"old_filename = :%s \n",filename);
if ((*tfile = open(filename, O_RDONLY)) == -1){ if ((*tfile = open(filename, O_RDONLY)) == -1){
fprintf(stderr, "open tallylog failed \n"); fprintf(stderr, "open tallylog failed \n");
return ; return ;
} }
}
if (lseek(*tfile, (off_t)uid*(off_t)sizeof(*tally), SEEK_SET) == (off_t)-1) { if (lseek(*tfile, (off_t)uid*(off_t)sizeof(*tally), SEEK_SET) == (off_t)-1) {
fprintf(stderr, "lseek tallylog failed \n"); fprintf(stderr, "lseek tallylog failed \n");

7
readme.txt Normal file
View File

@ -0,0 +1,7 @@
bioctl status 获取生物特征总开关状态
bioctl status greeter|screensaver|polkit|sudo|su|login 获取应用开关状态
bioctl enable|disable 打开|关闭 生物特征总开关
bioctl enable|disable greeter|screensaver|polkit|sudo|su|login 打开|关闭 应用生物特征开关

View File

@ -0,0 +1,26 @@
project(uniauth-backend)
set(CMAKE_AUTOMOC ON)
include_directories(
${Qt5Core_INCLUDE_DIRS}
${Qt5DBus_INCLUDE_DIRS}
)
set(bin_SRCS
${bin_SRCS}
src/main.cpp
src/biodeviceinfo.h
src/biodeviceinfo.cpp
src/serviceinterface.h
src/serviceinterface.cpp
src/servicemanager.h
src/servicemanager.cpp
)
add_executable(uniauth-backend ${bin_SRCS})
target_link_libraries(uniauth-backend Qt5::Core Qt5::DBus)
install(TARGETS uniauth-backend DESTINATION bin)
install(FILES org.ukui.UniauthBackend.conf DESTINATION /etc/dbus-1/system.d/)
install(FILES org.ukui.UniauthBackend.service DESTINATION /usr/share/dbus-1/system-services/)

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<!-- Only root can own the service -->
<policy user="root">
<allow own="org.ukui.UniauthBackend"/>
<allow send_interface="org.ukui.UniauthBackend"/>
</policy>
<!-- Allow anyone to invoke methods on the interfaces -->
<policy context="default">
<allow send_destination="org.ukui.UniauthBackend"
send_interface="org.ukui.UniauthBackend"/>
<allow send_destination="org.ukui.UniauthBackend"
send_interface="org.freedesktop.DBus.Introspectable"/>
<allow send_destination="org.ukui.UniauthBackend"
send_interface="org.freedesktop.DBus.Properties"/>
</policy>
</busconfig>

View File

@ -0,0 +1,4 @@
[D-BUS Service]
Name=org.ukui.UniauthBackend
Exec=/usr/bin/uniauth-backend
User=root

View File

@ -0,0 +1,53 @@
/*
* Copyright (C) 2022 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
**/
#include "biodeviceinfo.h"
void registerCustomTypes()
{
qDBusRegisterMetaType<DeviceInfo>();
qDBusRegisterMetaType<QList<QDBusVariant> >();
}
QDBusArgument &operator<<(QDBusArgument &argument, const DeviceInfo &deviceInfo)
{
argument.beginStructure();
argument << deviceInfo.device_id << deviceInfo.device_shortname
<< deviceInfo.device_fullname << deviceInfo.driver_enable
<< deviceInfo.device_available
<< deviceInfo.biotype << deviceInfo.stotype
<< deviceInfo.eigtype << deviceInfo.vertype
<< deviceInfo.idtype << deviceInfo.bustype
<< deviceInfo.dev_status << deviceInfo.ops_status;
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument, DeviceInfo &deviceInfo)
{
argument.beginStructure();
argument >> deviceInfo.device_id >> deviceInfo.device_shortname
>> deviceInfo.device_fullname >> deviceInfo.driver_enable
>> deviceInfo.device_available
>> deviceInfo.biotype >> deviceInfo.stotype
>> deviceInfo.eigtype >> deviceInfo.vertype
>> deviceInfo.idtype >> deviceInfo.bustype
>> deviceInfo.dev_status >> deviceInfo.ops_status;
argument.endStructure();
return argument;
}

View File

@ -0,0 +1,58 @@
/*
* Copyright (C) 2022 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
**/
#ifndef BIODEVICEINFO_H
#define BIODEVICEINFO_H
#include <QDBusInterface>
#include <QDBusArgument>
#include <QDBusMetaType>
struct DeviceInfo {
int device_id;
QString device_shortname; /* aka driverName */
QString device_fullname;
int driver_enable; /* The corresponding driver is enabled/disabled */
int device_available; /* The driver is enabled and the device is connected */
int biotype;
int stotype;
int eigtype;
int vertype;
int idtype;
int bustype;
int dev_status;
int ops_status;
};
enum BioType {
BIOTYPE_FINGERPRINT,
BIOTYPE_FINGERVEIN,
BIOTYPE_IRIS,
BIOTYPE_FACE,
BIOTYPE_VOICEPRINT,
__MAX_NR_BIOTYPES
};
#define REMOTE_QRCODE_TYPE (8)
Q_DECLARE_METATYPE(DeviceInfo)
Q_DECLARE_METATYPE(QList<QDBusVariant>)
void registerCustomTypes();
QDBusArgument &operator<<(QDBusArgument &argument, const DeviceInfo &deviceInfo);
const QDBusArgument &operator>>(const QDBusArgument &argument, DeviceInfo &deviceInfo);
#endif // BIODEVICEINFO_H

View File

@ -0,0 +1,29 @@
/*
* Copyright (C) 2022 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
**/
#include <QCoreApplication>
#include "serviceinterface.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
ServiceInterface serviveInterface;
Q_UNUSED(serviveInterface);
return a.exec();
}

View File

@ -0,0 +1,766 @@
/*
* Copyright (C) 2022 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
**/
#include "serviceinterface.h"
#include <QDBusConnection>
#include <QSettings>
#include <QDir>
#include <pwd.h>
#include <unistd.h>
#include <sys/types.h>
#include <QFileSystemWatcher>
#include <QDebug>
#include <QProcess>
#include <QDBusPendingReply>
#include <QDBusMetaType>
#include <QDBusConnectionInterface>
#include <QDBusContext>
#include <QDBusMessage>
#include "servicemanager.h"
#define COMM_CONFIG_PATH "/etc/biometric-auth/ukui-biometric.conf"
#define USER_CONFIG_PATH "/home/%1/.biometric_auth/ukui_biometric.conf"
ServiceInterface::ServiceInterface()
{
bool res = QDBusConnection::systemBus().registerService("org.ukui.UniauthBackend");
if(!res){
qInfo()<<"registerService org.ukui.UniauthBackend failed!!";
exit(0);
}
res = QDBusConnection::systemBus().registerObject("/org/ukui/UniauthBackend", "org.ukui.UniauthBackend",
this, QDBusConnection::ExportAllSlots|QDBusConnection::ExportAllSignals);
if(!res){
qInfo()<<"registerObject /org/ukui/UniauthBackend failed!!";
exit(0);
}
registerCustomTypes();
m_serviceInterface = new QDBusInterface(DBUS_SERVICE, DBUS_PATH,
DBUS_INTERFACE,
QDBusConnection::systemBus());
m_serviceInterface->setTimeout(2147483647);
connect(m_serviceInterface, SIGNAL(USBDeviceHotPlug(int, int, int)),
this, SLOT(onUSBDeviceHotPlug(int,int,int)));
updateCommDefaultDevice(-1);
initData();
ServiceManager *sm = ServiceManager::instance();
connect(sm, &ServiceManager::serviceStatusChanged,
this, &ServiceInterface::onBiometricDbusChanged);
}
void ServiceInterface::setDefaultDevice(QString userName, int bioDevType, QString deviceName)
{
QString configPath = QString(USER_CONFIG_PATH).arg(userName);
qDebug() << configPath << bioDevType ;
QSettings settings(configPath, QSettings::IniFormat);
switch (bioDevType) {
case BIOTYPE_FACE:
settings.setValue("FC_DefaultDevice", deviceName);
break;
case BIOTYPE_FINGERPRINT:
settings.setValue("FP_DefaultDevice", deviceName);
break;
case BIOTYPE_FINGERVEIN:
settings.setValue("FV_DefaultDevice", deviceName);
break;
case BIOTYPE_IRIS:
settings.setValue("IR_DefaultDevice", deviceName);
break;
case BIOTYPE_VOICEPRINT:
settings.setValue("VP_DefaultDevice", deviceName);
break;
case REMOTE_QRCODE_TYPE:
settings.setValue("WC_DefaultDevice", deviceName);
break;
default:
break;
}
settings.sync();
qDebug()<<"setDefaultDevice:"<<userName<<","<<bioDevType<<","<<deviceName;
emit defaultDeviceChanged(userName, bioDevType, deviceName);
}
void ServiceInterface::setDefaultDevice(int bioDevType, QString deviceName)
{
QDBusConnection conn = connection();
QDBusMessage msg = message();
int uid = conn.interface()->serviceUid(msg.service()).value();
struct passwd *pwinfo = getpwuid(uid);
if (pwinfo && pwinfo->pw_name) {
setDefaultDevice(pwinfo->pw_name, bioDevType, deviceName);
} else {
qInfo()<<"GetPWInfo failed!!";
}
}
QString ServiceInterface::getDefaultDevice(QString userName, int bioDevType)
{
QString defaultDevice = "";
QString configPath = QString(USER_CONFIG_PATH).arg(userName);
QSettings settings(configPath, QSettings::IniFormat);
// 获取用户旧的默认设备
if (settings.contains("DefaultDevice")) {
QString strOldDefDev = settings.value("DefaultDevice").toString();
if (!strOldDefDev.isEmpty()) {
for (auto devInfo : m_listDeviceInfos) {
if (devInfo && devInfo->device_shortname == strOldDefDev) {
QString strBioDefType = "";
switch(devInfo->biotype) {
case BIOTYPE_FINGERPRINT:
strBioDefType = "FP_DefaultDevice";
break;
case BIOTYPE_FINGERVEIN:
strBioDefType = "FV_DefaultDevice";
break;
case BIOTYPE_IRIS:
strBioDefType = "IR_DefaultDevice";
break;
case BIOTYPE_FACE:
strBioDefType = "FC_DefaultDevice";
break;
case BIOTYPE_VOICEPRINT:
strBioDefType = "VP_DefaultDevice";
break;
case REMOTE_QRCODE_TYPE:
strBioDefType = "WC_DefaultDevice";
break;
default:
break;
}
if (!strBioDefType.isEmpty() && !settings.contains(strBioDefType)) {
settings.setValue(strBioDefType, strOldDefDev);
settings.setValue("DefaultDevice", "");
settings.sync();
}
if (bioDevType == devInfo->biotype) {
return strOldDefDev;
}
break;
}
}
}
}
switch (bioDevType) {
case BIOTYPE_FACE:
defaultDevice = settings.value("FC_DefaultDevice").toString();
break;
case BIOTYPE_FINGERPRINT:
defaultDevice = settings.value("FP_DefaultDevice").toString();
break;
case BIOTYPE_FINGERVEIN:
defaultDevice = settings.value("FV_DefaultDevice").toString();
break;
case BIOTYPE_IRIS:
defaultDevice = settings.value("IR_DefaultDevice").toString();
break;
case BIOTYPE_VOICEPRINT:
defaultDevice = settings.value("VP_DefaultDevice").toString();
break;
case REMOTE_QRCODE_TYPE:
defaultDevice = settings.value("WC_DefaultDevice").toString();
break;
default:
defaultDevice = settings.value("DefaultDevice").toString();
break;
}
if(defaultDevice.isEmpty()) {
QSettings settings2(COMM_CONFIG_PATH, QSettings::IniFormat);
switch (bioDevType) {
case BIOTYPE_FACE:
defaultDevice = settings2.value("FC_DefaultDevice").toString();
break;
case BIOTYPE_FINGERPRINT:
defaultDevice = settings2.value("FP_DefaultDevice").toString();
break;
case BIOTYPE_FINGERVEIN:
defaultDevice = settings2.value("FV_DefaultDevice").toString();
break;
case BIOTYPE_IRIS:
defaultDevice = settings2.value("IR_DefaultDevice").toString();
break;
case BIOTYPE_VOICEPRINT:
defaultDevice = settings2.value("VP_DefaultDevice").toString();
break;
case REMOTE_QRCODE_TYPE:
defaultDevice = settings2.value("WC_DefaultDevice").toString();
break;
default:
defaultDevice = settings2.value("DefaultDevice").toString();
break;
}
}
return defaultDevice;
}
QStringList ServiceInterface::getAllDefaultDevice(QString userName)
{
QStringList listDefDevice;
QString configPath = QString(USER_CONFIG_PATH).arg(userName);
QSettings settings(configPath, QSettings::IniFormat);
int nOldDefType = -1;
// 获取用户旧的默认设备
if (settings.contains("DefaultDevice")) {
QString strOldDefDev = settings.value("DefaultDevice").toString();
if (!strOldDefDev.isEmpty()) {
for (auto devInfo : m_listDeviceInfos) {
if (devInfo && devInfo->device_shortname == strOldDefDev) {
QString strBioDefType = "";
switch(devInfo->biotype) {
case BIOTYPE_FINGERPRINT:
strBioDefType = "FP_DefaultDevice";
break;
case BIOTYPE_FINGERVEIN:
strBioDefType = "FV_DefaultDevice";
break;
case BIOTYPE_IRIS:
strBioDefType = "IR_DefaultDevice";
break;
case BIOTYPE_FACE:
strBioDefType = "FC_DefaultDevice";
break;
case BIOTYPE_VOICEPRINT:
strBioDefType = "VP_DefaultDevice";
break;
case REMOTE_QRCODE_TYPE:
strBioDefType = "WC_DefaultDevice";
break;
default:
break;
}
if (!strBioDefType.isEmpty() && !settings.contains(strBioDefType)) {
nOldDefType = devInfo->biotype;
listDefDevice.push_back(strOldDefDev);
settings.setValue(strBioDefType, strOldDefDev);
settings.setValue("DefaultDevice", "");
settings.sync();
}
break;
}
}
}
}
QSettings settings2(COMM_CONFIG_PATH, QSettings::IniFormat);
for (int nBioType = 0; nBioType <= REMOTE_QRCODE_TYPE; nBioType++) {
QString defaultDevice = "";
if (nBioType == nOldDefType)
continue;
switch (nBioType) {
case BIOTYPE_FACE:
defaultDevice = settings.value("FC_DefaultDevice").toString();
break;
case BIOTYPE_FINGERPRINT:
defaultDevice = settings.value("FP_DefaultDevice").toString();
break;
case BIOTYPE_FINGERVEIN:
defaultDevice = settings.value("FV_DefaultDevice").toString();
break;
case BIOTYPE_IRIS:
defaultDevice = settings.value("IR_DefaultDevice").toString();
break;
case BIOTYPE_VOICEPRINT:
defaultDevice = settings.value("VP_DefaultDevice").toString();
break;
case REMOTE_QRCODE_TYPE:
defaultDevice = settings.value("WC_DefaultDevice").toString();
break;
default:
break;
}
if(defaultDevice.isEmpty()) {
switch (nBioType) {
case BIOTYPE_FACE:
defaultDevice = settings2.value("FC_DefaultDevice").toString();
break;
case BIOTYPE_FINGERPRINT:
defaultDevice = settings2.value("FP_DefaultDevice").toString();
break;
case BIOTYPE_FINGERVEIN:
defaultDevice = settings2.value("FV_DefaultDevice").toString();
break;
case BIOTYPE_IRIS:
defaultDevice = settings2.value("IR_DefaultDevice").toString();
break;
case BIOTYPE_VOICEPRINT:
defaultDevice = settings2.value("VP_DefaultDevice").toString();
break;
case REMOTE_QRCODE_TYPE:
defaultDevice = settings2.value("WC_DefaultDevice").toString();
break;
default:
break;
}
}
if (!defaultDevice.isEmpty()) {
listDefDevice.push_back(defaultDevice);
}
}
return listDefDevice;
}
//设置通用默认设备
void ServiceInterface::setCommDefaultDevice(int bioDevType, QString deviceName)
{
QSettings settings(COMM_CONFIG_PATH, QSettings::IniFormat);
switch (bioDevType) {
case BIOTYPE_FACE:
settings.setValue("FC_DefaultDevice", deviceName);
break;
case BIOTYPE_FINGERPRINT:
settings.setValue("FP_DefaultDevice", deviceName);
break;
case BIOTYPE_FINGERVEIN:
settings.setValue("FV_DefaultDevice", deviceName);
break;
case BIOTYPE_IRIS:
settings.setValue("IR_DefaultDevice", deviceName);
break;
case BIOTYPE_VOICEPRINT:
settings.setValue("VP_DefaultDevice", deviceName);
break;
case REMOTE_QRCODE_TYPE:
settings.setValue("WC_DefaultDevice", deviceName);
break;
default:
break;
}
settings.sync();
qDebug()<<"setCommDefaultDevice:"<<bioDevType<<","<<deviceName;
emit defaultDeviceChanged("", bioDevType, deviceName);
}
//获取通用默认设备
QString ServiceInterface::getCommDefaultDevice(int bioDevType)
{
QString defaultDevice = "";
QSettings settings2(COMM_CONFIG_PATH, QSettings::IniFormat);
switch (bioDevType) {
case BIOTYPE_FACE:
defaultDevice = settings2.value("FC_DefaultDevice").toString();
break;
case BIOTYPE_FINGERPRINT:
defaultDevice = settings2.value("FP_DefaultDevice").toString();
break;
case BIOTYPE_FINGERVEIN:
defaultDevice = settings2.value("FV_DefaultDevice").toString();
break;
case BIOTYPE_IRIS:
defaultDevice = settings2.value("IR_DefaultDevice").toString();
break;
case BIOTYPE_VOICEPRINT:
defaultDevice = settings2.value("VP_DefaultDevice").toString();
break;
case REMOTE_QRCODE_TYPE:
defaultDevice = settings2.value("WC_DefaultDevice").toString();
break;
default:
defaultDevice = settings2.value("DefaultDevice").toString();
break;
}
return defaultDevice;
}
void ServiceInterface::setBioAuthStatus(int bioAuthType, bool status)
{
QDBusConnection conn = connection();
QDBusMessage msg = message();
int uid = conn.interface()->serviceUid(msg.service()).value();
struct passwd *pwinfo = getpwuid(uid);
if (pwinfo && pwinfo->pw_name) {
QString configPath = QString(USER_CONFIG_PATH).arg(pwinfo->pw_name);
QSettings settings(configPath, QSettings::IniFormat);
switch (bioAuthType) {
case ENABLETYPE_BIO:
settings.setValue("EnableAuth", status);
break;
case ENABLETYPE_SAVER:
settings.setValue("SaverEnable", status);
break;
case ENABLETYPE_GREETER:
settings.setValue("GreeterEnable", status);
break;
case ENABLETYPE_POLKIT:
settings.setValue("PolkitEnable", status);
break;
case ENABLETYPE_SU:
settings.setValue("SuEnable", status);
break;
case ENABLETYPE_SUDO:
settings.setValue("SudoEnable", status);
break;
case ENABLETYPE_LOGIN:
settings.setValue("LoginEnable", status);
break;
default:
break;
}
settings.sync();
emit bioAuthStatusChanged(pwinfo->pw_name, bioAuthType, status);
qDebug()<<"setBioAuthStatus:"<<pwinfo->pw_name<<","<<bioAuthType<<","<<status;
} else {
qInfo()<<"GetPWInfo failed!!";
}
}
bool ServiceInterface::getBioAuthStatus(QString userName, int bioAuthType)
{
QString configPath = QString(USER_CONFIG_PATH).arg(userName);
QSettings settings(configPath, QSettings::IniFormat);
QString strBioAuthType = "";
switch (bioAuthType) {
case ENABLETYPE_BIO:
strBioAuthType = "EnableAuth";
break;
case ENABLETYPE_SAVER:
strBioAuthType = "SaverEnable";
break;
case ENABLETYPE_GREETER:
strBioAuthType = "GreeterEnable";
break;
case ENABLETYPE_POLKIT:
strBioAuthType = "PolkitEnable";
break;
case ENABLETYPE_SU:
strBioAuthType = "SuEnable";
break;
case ENABLETYPE_SUDO:
strBioAuthType = "SudoEnable";
break;
case ENABLETYPE_LOGIN:
strBioAuthType = "LoginEnable";
break;
default:
return false;
}
if (settings.contains(strBioAuthType)) {
return settings.value(strBioAuthType).toBool();
} else {
QSettings settings2(COMM_CONFIG_PATH, QSettings::IniFormat);
if (settings2.contains(strBioAuthType)) {
return settings2.value(strBioAuthType).toBool();
} else {
return true;
}
}
}
int ServiceInterface::getMaxFailedTimes()
{
QSettings sysSettings(COMM_CONFIG_PATH, QSettings::IniFormat);
if(sysSettings.contains("MaxFailedTimes"))
return sysSettings.value("MaxFailedTimes").toInt();
else
return 3;
}
bool ServiceInterface::getQRCodeEnable()
{
bool isEnable = false;
QSettings sysSettings(COMM_CONFIG_PATH, QSettings::IniFormat);
sysSettings.beginGroup("Functions");
if (sysSettings.allKeys().contains("EnableQRCode")) {
isEnable = sysSettings.value("EnableQRCode").toBool();
}
sysSettings.endGroup();
return isEnable;
}
// 获取是否双认证
bool ServiceInterface::getDoubleAuth()
{
QSettings sysSettings(COMM_CONFIG_PATH, QSettings::IniFormat);
if(sysSettings.contains("DoubleAuth"))
return sysSettings.value("DoubleAuth").toBool();
else
return false;
}
// 获取用户绑定
bool ServiceInterface::getUserBind()
{
QSettings sysSettings(COMM_CONFIG_PATH, QSettings::IniFormat);
if(sysSettings.contains("UserBind"))
return sysSettings.value("UserBind").toBool();
else
return false;
}
// 获取是否在控制面板显示
bool ServiceInterface::getIsShownInControlCenter()
{
QSettings sysSettings(COMM_CONFIG_PATH, QSettings::IniFormat);
if(sysSettings.contains("isShownInControlCenter"))
return sysSettings.value("isShownInControlCenter").toBool();
else
return false;
}
// 获取是否使用第一个设备
bool ServiceInterface::getUseFirstDevice()
{
QSettings sysSettings(COMM_CONFIG_PATH, QSettings::IniFormat);
if(sysSettings.contains("UseFirstDevice"))
return sysSettings.value("UseFirstDevice").toBool();
else
return false;
}
// 获取是否隐藏切换按钮
bool ServiceInterface::getHiddenSwitchButton()
{
QSettings sysSettings(COMM_CONFIG_PATH, QSettings::IniFormat);
if(sysSettings.contains("HiddenSwitchButton"))
return sysSettings.value("HiddenSwitchButton").toBool();
else
return false;
}
// 获取旧版app使能值
int ServiceInterface::getOldAppStatus()
{
QSettings sysSettings(COMM_CONFIG_PATH, QSettings::IniFormat);
if(sysSettings.contains("EnableAuthApp"))
return sysSettings.value("EnableAuthApp").toInt();
else
return 63;
}
void ServiceInterface::onUSBDeviceHotPlug(int drvid, int action, int deviceNum)
{
if (action > 0) {
qDebug()<<"onUSBDeviceHotPlug in:"<<drvid;
updateCommDefaultDevice(drvid);
}
}
void ServiceInterface::waitBiometricServiceStatus()
{
qDebug()<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~` get biometric status";
QDBusInterface iface("org.freedesktop.systemd1", "/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",QDBusConnection::systemBus());
QDBusReply<QDBusObjectPath> bioPath = iface.call("GetUnit","biometric-authentication.service");
if(!bioPath.isValid()){
return ;
}
QDBusInterface bioface("org.freedesktop.systemd1", bioPath.value().path(),
"org.freedesktop.DBus.Properties", QDBusConnection::systemBus());
QDBusReply<QDBusVariant> sessionReply = bioface.call("Get", "org.freedesktop.systemd1.Unit", "UnitFileState");
if(!sessionReply.isValid())
qWarning() << sessionReply.error();
else {
QString res = sessionReply.value().variant().toString();
if(res == "disable")
return;
}
qDebug()<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ get activeState";
int times = 0;
while(times<20){
QDBusReply<QDBusVariant> sessionReply = bioface.call("Get", "org.freedesktop.systemd1.Unit", "ActiveState");
if(!sessionReply.isValid()){
qWarning() << sessionReply.error();
return ;
}
else {
QString res = sessionReply.value().variant().toString();
if(res == "activating"){
times ++;
usleep(100000);
}else{
break;
}
}
}
qDebug()<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ times = "<<times;
}
void ServiceInterface::updateCommDefaultDevice(int nDriId)
{
if (!m_serviceInterface) {
return ;
}
QVariant variant;
QDBusArgument argument;
QList<QDBusVariant> qlist;
QDBusVariant item;
DeviceInfo *deviceInfo;
/* 返回值为 i -- int 和 av -- array of variant */
QDBusPendingReply<int, QList<QDBusVariant> > reply = m_serviceInterface->call("GetDrvList");
reply.waitForFinished();
if (reply.isError()) {
qDebug() << "GUI:" << reply.error();
deviceCount = 0;
return;
}
/* 解析 DBus 返回值reply 有两个返回值,都是 QVariant 类型 */
variant = reply.argumentAt(0); /* 得到第一个返回值 */
deviceCount = variant.value<int>(); /* 解封装得到设备个数 */
variant = reply.argumentAt(1); /* 得到第二个返回值 */
argument = variant.value<QDBusArgument>(); /* 解封装获取QDBusArgument对象 */
argument >> qlist; /* 使用运算符重载提取 argument 对象里面存储的列表对象 */
if (nDriId != -1) { // 指定设备接入
for (int i = 0; i < deviceCount; i++) {
item = qlist[i]; /* 取出一个元素 */
variant = item.variant(); /* 转为普通QVariant对象 */
/* 解封装得到 QDBusArgument 对象 */
argument = variant.value<QDBusArgument>();
deviceInfo = new DeviceInfo();
argument >> *deviceInfo; /* 提取最终的 DeviceInfo 结构体 */
if (nDriId == deviceInfo->device_id) {
if (getCommDefaultDevice(deviceInfo->biotype).isEmpty()) {
setCommDefaultDevice(deviceInfo->biotype, deviceInfo->device_shortname);
}
break;
}
}
} else {
for (auto devInfo : m_listDeviceInfos) {
if (devInfo) {
delete devInfo;
devInfo = nullptr;
}
}
m_listDeviceInfos.clear();
for (int i = 0; i < deviceCount; i++) {
item = qlist[i]; /* 取出一个元素 */
variant = item.variant(); /* 转为普通QVariant对象 */
/* 解封装得到 QDBusArgument 对象 */
argument = variant.value<QDBusArgument>();
deviceInfo = new DeviceInfo();
argument >> *deviceInfo; /* 提取最终的 DeviceInfo 结构体 */
m_listDeviceInfos.push_back(deviceInfo);
}
}
}
void ServiceInterface::initData()
{
// 沿用旧app enable
QSettings sysSettings(COMM_CONFIG_PATH, QSettings::IniFormat);
if(sysSettings.contains("EnableAuthApp") || sysSettings.contains("Functions/EnableAuthApp")) {
int nAppOldStatus = 0;
if (sysSettings.contains("Functions/EnableAuthApp")) {
nAppOldStatus = sysSettings.value("Functions/EnableAuthApp").toInt();
} else {
nAppOldStatus = sysSettings.value("EnableAuthApp").toInt();
}
if ((nAppOldStatus&0x01) && !sysSettings.contains("GreeterEnable")) { // greeter
sysSettings.setValue("GreeterEnable", true);
}
if ((nAppOldStatus&0x02) && !sysSettings.contains("SaverEnable")) { // saver
sysSettings.setValue("SaverEnable", true);
}
if ((nAppOldStatus&0x04) && !sysSettings.contains("PolkitEnable")) { // polkit
sysSettings.setValue("PolkitEnable", true);
}
if ((nAppOldStatus&0x08) && !sysSettings.contains("SudoEnable")) { // sudo
sysSettings.setValue("SudoEnable", true);
}
if ((nAppOldStatus&0x10) && !sysSettings.contains("SuEnable")) { // su
sysSettings.setValue("SuEnable", true);
}
if ((nAppOldStatus&0x20) && !sysSettings.contains("LoginEnable")) { // login
sysSettings.setValue("LoginEnable", true);
}
}
// 沿用旧的默认设备
if(sysSettings.contains("DefaultDevice")) {
QString strOldDefDev = sysSettings.value("DefaultDevice").toString();
if (!strOldDefDev.isEmpty()) {
for (auto devInfo : m_listDeviceInfos) {
if (devInfo && devInfo->device_shortname == strOldDefDev) {
QString strBioDefType = "";
switch(devInfo->biotype) {
case BIOTYPE_FINGERPRINT:
strBioDefType = "FP_DefaultDevice";
break;
case BIOTYPE_FINGERVEIN:
strBioDefType = "FV_DefaultDevice";
break;
case BIOTYPE_IRIS:
strBioDefType = "IR_DefaultDevice";
break;
case BIOTYPE_FACE:
strBioDefType = "FC_DefaultDevice";
break;
case BIOTYPE_VOICEPRINT:
strBioDefType = "VP_DefaultDevice";
break;
case REMOTE_QRCODE_TYPE:
strBioDefType = "WC_DefaultDevice";
break;
default:
break;
}
if (!strBioDefType.isEmpty() && !sysSettings.contains(strBioDefType)) {
sysSettings.setValue(strBioDefType, strOldDefDev);
sysSettings.setValue("DefaultDevice", "");
}
break;
}
}
}
}
// 设置未设置过默认设备的类型,如果驱动已打开且已连接
for (auto devInfo : m_listDeviceInfos) {
if (devInfo && devInfo->device_available > 0 && devInfo->driver_enable > 0) {
QString strBioDefType = "";
switch(devInfo->biotype) {
case BIOTYPE_FINGERPRINT:
strBioDefType = "FP_DefaultDevice";
break;
case BIOTYPE_FINGERVEIN:
strBioDefType = "FV_DefaultDevice";
break;
case BIOTYPE_IRIS:
strBioDefType = "IR_DefaultDevice";
break;
case BIOTYPE_FACE:
strBioDefType = "FC_DefaultDevice";
break;
case BIOTYPE_VOICEPRINT:
strBioDefType = "VP_DefaultDevice";
break;
case REMOTE_QRCODE_TYPE:
strBioDefType = "WC_DefaultDevice";
break;
default:
break;
}
if (!strBioDefType.isEmpty() && !sysSettings.contains(strBioDefType)) {
sysSettings.setValue(strBioDefType, devInfo->device_shortname);
}
}
}
sysSettings.sync();
}
void ServiceInterface::onBiometricDbusChanged(bool bActive)
{
qDebug()<<"BiometricDbus:"<<bActive;
if (bActive) {
updateCommDefaultDevice(-1);
initData();
}
}

View File

@ -0,0 +1,105 @@
/*
* Copyright (C) 2022 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
**/
#ifndef SERVICEINTERFACE_H
#define SERVICEINTERFACE_H
#include "biodeviceinfo.h"
#include <QCoreApplication>
#include <QDBusContext>
#include <QObject>
#include <QFileSystemWatcher>
#define DBUS_SERVICE "org.ukui.Biometric"
#define DBUS_PATH "/org/ukui/Biometric"
#define DBUS_INTERFACE "org.ukui.Biometric"
enum authEnableType {
ENABLETYPE_BIO, // 全局总使能
ENABLETYPE_SAVER, // 锁屏
ENABLETYPE_GREETER, // 登录
ENABLETYPE_POLKIT, // 授权
ENABLETYPE_SU, // 暂保留
ENABLETYPE_SUDO, // 暂保留
ENABLETYPE_LOGIN, // 暂保留
};
class ServiceInterface : public QObject, protected QDBusContext
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.ukui.UniauthBackend")
public:
ServiceInterface();
public slots:
// 设置默认设备
void setDefaultDevice(int bioDevType, QString deviceName);
// 获取默认设备
QString getDefaultDevice(QString userName, int bioDevType);
// 获取所有默认设备
QStringList getAllDefaultDevice(QString userName);
//生物特征开关接口
bool getBioAuthStatus(QString userName, int bioAuthType);
void setBioAuthStatus(int bioAuthType, bool status);
// 获取最大失败次数
int getMaxFailedTimes();
// 获取是否使能微信扫码登录
bool getQRCodeEnable();
// 获取是否双认证
bool getDoubleAuth();
// 获取用户绑定
bool getUserBind();
// 获取是否在控制面板显示
bool getIsShownInControlCenter();
// 获取是否使用第一个设备
bool getUseFirstDevice();
// 获取是否隐藏切换按钮
bool getHiddenSwitchButton();
private slots:
void onUSBDeviceHotPlug(int drvid, int action, int deviceNum);
void onBiometricDbusChanged(bool bActive);
signals:
//默认设备改变
void defaultDeviceChanged(QString userName, int bioDevType, QString deviceName);
//开关状态改变
void bioAuthStatusChanged(QString userName, int type, bool status);
private:
//设置默认设备
void setDefaultDevice(QString userName, int bioDevType, QString deviceName);
//设置通用默认设备
void setCommDefaultDevice(int bioDevType, QString deviceName);
//获取通用默认设备
QString getCommDefaultDevice(int bioDevType);
// 获取旧版app使能值
int getOldAppStatus();
// 初始化数据
void initData();
// 更新通用默认设备
void updateCommDefaultDevice(int nDriId);
// 等待生物识别服务
void waitBiometricServiceStatus();
private:
QDBusInterface *m_serviceInterface = nullptr;
QList<DeviceInfo *> m_listDeviceInfos;
int deviceCount = 0;
};
#endif // SERVICEINTERFACE_H

View File

@ -0,0 +1,101 @@
/*
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
**/
#include "servicemanager.h"
#include <QDebug>
#include <QDBusReply>
#define SERVICE "biometric-authentication.service"
#define DBUS_SERVICE "org.ukui.Biometric"
#define DBUS_PATH "/org/ukui/Biometric"
#define DBUS_INTERFACE "org.ukui.Biometric"
#define FD_DBUS_SERVICE "org.freedesktop.DBus"
#define FD_DBUS_PATH "/org/freedesktop/DBus"
#define FD_DBUS_INTERFACE "org.freedesktop.DBus"
ServiceManager *ServiceManager::instance_ = nullptr;
ServiceManager::ServiceManager(QObject *parent)
: QObject(parent),
dbusService(nullptr),
bioService(nullptr)
{
init();
}
void ServiceManager::init()
{
if(!dbusService)
{
dbusService = new QDBusInterface(FD_DBUS_SERVICE,
FD_DBUS_PATH,
FD_DBUS_INTERFACE,
QDBusConnection::systemBus());
connect(dbusService, SIGNAL(NameOwnerChanged(QString, QString, QString)),
this, SLOT(onDBusNameOwnerChanged(QString,QString,QString)));
}
}
ServiceManager *ServiceManager::instance()
{
if(!instance_)
{
instance_ = new ServiceManager;
}
return instance_;
}
bool ServiceManager::connectToService()
{
if(!bioService)
{
bioService = new QDBusInterface(DBUS_SERVICE,
DBUS_PATH,
DBUS_INTERFACE,
QDBusConnection::systemBus());
}
return bioService->isValid();
}
void ServiceManager::onDBusNameOwnerChanged(const QString &name,
const QString &oldOwner,
const QString &newOwner)
{
if(name == DBUS_SERVICE)
{
qDebug() << "service status changed:"
<< (newOwner.isEmpty() ? "inactivate" : "activate");
Q_EMIT serviceStatusChanged(!newOwner.isEmpty());
}
}
/*!
* \brief checkServiceExist
*
*/
bool ServiceManager::serviceExists()
{
QDBusReply<bool> reply = dbusService->call("NameHasOwner", DBUS_SERVICE);
if(!reply.isValid())
{
qDebug() << "check service exists error:" << reply.error();
return false;
}
return reply.value();
}

View File

@ -0,0 +1,52 @@
/*
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
**/
#ifndef SERVICEMANAGER_H
#define SERVICEMANAGER_H
#include <QObject>
#include <QDBusInterface>
class ServiceManager : public QObject
{
Q_OBJECT
public:
static ServiceManager *instance();
bool serviceExists();
private:
explicit ServiceManager(QObject *parent = nullptr);
void init();
bool connectToService();
Q_SIGNALS:
void serviceStatusChanged(bool activate);
public Q_SLOTS:
void onDBusNameOwnerChanged(const QString &name,
const QString &oldOwner,
const QString &newOwner);
private:
static ServiceManager *instance_;
QDBusInterface *dbusService;
QDBusInterface *bioService;
bool serviceStatus;
};
#endif // SERVICEMANAGER_H