ukui-biometric-auth/ 0000775 0001750 0001750 00000000000 15167732644 013406 5 ustar feng feng ukui-biometric-auth/bioauth-bin/ 0000775 0001750 0001750 00000000000 15167732644 015607 5 ustar feng feng ukui-biometric-auth/bioauth-bin/src/ 0000775 0001750 0001750 00000000000 15167732644 016376 5 ustar feng feng ukui-biometric-auth/bioauth-bin/src/keywatcher.cpp 0000664 0001750 0001750 00000004110 15167732630 021237 0 ustar feng feng /*
* Copyright (C) 2023 KylinSoftCo., 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 .
*
**/
#include "keywatcher.h"
#include
KeyWatcher::KeyWatcher(QObject *parent)
: QThread(parent)
{
}
void KeyWatcher::run()
{
// 修改终端属性,保证按键被立即接收
struct termios current;
tcgetattr(0, &save);
current = save;
current.c_lflag &= ~ICANON;
current.c_lflag &= ~ECHO;
current.c_cc[VMIN] = 1;
current.c_cc[VTIME] = 0;
tcsetattr(0, TCSANOW, ¤t);
bool isInputEnd = false;
while(!isInterruptionRequested()){
fd_set readfds;
FD_ZERO(&readfds);
FD_SET(0, &readfds);
char ch;
switch(select(32, &readfds, NULL, NULL, NULL)){
case 0:
// printf("select time out\n");
break;
case -1:
// printf("select error\n");
break;
default:
// 'q' | 'Q' or Esc
if((ch = getchar()) == 'q' || ch == 'Q' || ch == 27 || ch == EOF){
tcsetattr(0, TCSANOW, &save);
emit exit();
if (ch == EOF) {
isInputEnd = true;
break;
}
}
}
if (isInputEnd) {
break;
}
}
tcsetattr(0, TCSANOW, &save); // 恢复原来的终端属性,以免干扰shall和之后的程序运行
}
void KeyWatcher::stop()
{
tcsetattr(0, TCSANOW, &save);
requestInterruption();
terminate();
wait();
}
ukui-biometric-auth/bioauth-bin/src/main.cpp 0000664 0001750 0001750 00000031446 15167732644 020036 0 ustar feng feng /*
* Copyright (C) 2023 KylinSoftCo., 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 .
*
**/
//#include "mainwindow.h"
#include
#include
#include
#include
#include
#include
#include
#include "generic.h"
#include "keywatcher.h"
#include "bioauth.h"
#include "biodevices.h"
#define START_COLOR "\033[1;31m"
#define RESULT_COLOR "\033[1;31m"
#define PROMPT_COLOR "\033[33m"
#define NOTIFY_COLOR //"\033[37m"
#define QUESTION_COLOR //"\033[1;37m"
#define RESET_COLOR "\033[0m"
bool enableDebug;
QString logPrefix;
BioAuth bioAuth;
enum MsgType
{
START,
PROMPT,
NOTIFY,
QUESTION,
RESULT
};
enum _Option
{
OPTION_TRY_AGAIN,
OPTION_SELECT_DEVICE,
OPTION_CANCEL,
OPTION_UNDEFINED
};
typedef enum _Option Option;
static QString lastMessage;
void showMessage(const QString &message, int type)
{
// filter out the same message
if(message == lastMessage)
return;
lastMessage = message;
char *text = message.toLocal8Bit().data();
switch(type) {
case START:
fprintf(stdout, START_COLOR "=== %s ===\n", text);
break;
case PROMPT:
fprintf(stdout, PROMPT_COLOR "%s\n", text);
break;
case NOTIFY:
fprintf(stdout, NOTIFY_COLOR "%s\n", text);
break;
case QUESTION:
fprintf(stdout, QUESTION_COLOR "%s", text);
break;
case RESULT:
fprintf(stdout, RESULT_COLOR "=== %s ===\n", text);
break;
default:
fprintf(stdout, "%s\n", text);
break;
}
fprintf(stdout, RESET_COLOR);
}
static bool isQuickInput() {
fd_set readfds;
FD_ZERO(&readfds);
FD_SET(0, &readfds); // stdin
struct timeval timeout = {0, 10*1000};
switch (select(32, &readfds, NULL, NULL, &timeout)) {
case 0: // time out
break;
case -1: // error
break;
default:
return true;
}
return false;
}
QString inputPinCode()
{
struct termios current;
struct termios save;
tcgetattr(0, &save);
current = save;
// current.c_lflag &= ~ICANON;
current.c_lflag &= ~ECHO;
current.c_cc[VMIN] = 0;
current.c_cc[VTIME] = 0;
tcsetattr(0, TCSANOW, ¤t);
QString password = "";
showMessage(QObject::tr("Enter the ukey password"), QUESTION);
char line[1024] = {0};
fgets(line, sizeof(line), stdin);
//scanf("%s",&line);
showMessage("\n", QUESTION);
line[1023] = '\0';
if(line[strnlen(line,1024) - 1] == '\n')
line[strnlen(line,1024) - 1] = '\0';
QString str(line);
tcsetattr(0, TCSANOW, &save); // 恢复原来的终端属性,以免干扰shall和之后的程序运行
return line;
}
Option showOption(bool showSelectDevices)
{
QStringList optionList;
QString message;
optionList << QObject::tr("Try it again");
if(showSelectDevices)
optionList << QObject::tr("Use other Devices");
optionList << QObject::tr("Cancel");
for(int i = 0; i < optionList.size(); i++){
message = QString(" %1. %2\n")
.arg(QString::number(i+1))
.arg(optionList.at(i));
showMessage(message, QUESTION);
}
message = QString("%1 (1-%2):")
.arg(QObject::tr("Choose the option"))
.arg(QString::number(optionList.size()));
showMessage(message, QUESTION);
char line[1024];
fgets(line, sizeof(line), stdin);
if(line[strnlen(line,1024) - 1] == '\n')
line[strnlen(line,1024) - 1] = '\0';
if(!strcmp(line, "1"))
return OPTION_TRY_AGAIN;
else if(!strcmp(line, "2"))
{
if(showSelectDevices)
return OPTION_SELECT_DEVICE;
else
return OPTION_CANCEL;
}
else if(showSelectDevices && !strcmp(line, "3"))
return OPTION_CANCEL;
else {
showMessage(QObject::tr("Invaild response \"") + line + "\"" + "," + QObject::tr("authentication will be canceld") , NOTIFY);
showMessage(QObject::tr("AUTHENTICATION CANCELED"), START);
exit(BIO_FAILED);
}
return OPTION_UNDEFINED;
}
DeviceInfo showDevices(const QMap> &devicesMap)
{
int count = 0;
QString message;
showMessage(QObject::tr("=== BIOMETRIC DEVICES ==="), PROMPT);
for(auto type : devicesMap.keys()) {
for(auto deviceInfo : devicesMap[type]) {
message = QString(" %1. [%2] %3")
.arg(QString::number(++count))
.arg(BioDevices::bioTypeToString_tr(type))
.arg(deviceInfo.device_shortname);
showMessage(message, NOTIFY);
}
}
message = QString("%1 (1-%2):")
.arg(QObject::tr("Choose the device"))
.arg(QString::number(count));
showMessage(message, QUESTION);
char line[1024];
fgets(line, sizeof(line), stdin);
if(line[strnlen(line,1024) - 1] == '\n')
line[strnlen(line,1024) - 1] = '\0';
for(auto ch : QString(line)) {
if(!ch.isDigit()){
showMessage(QObject::tr("Invaild response \"") + line + "\"" + "," +QObject::tr("authentication will be canceld") , NOTIFY);
showMessage(QObject::tr("AUTHENTICATION CANCELED"), START);
exit(BIO_FAILED);
}
}
int deviceIndex = QString(line).toInt();
if(deviceIndex > count) {
showMessage(QObject::tr("Invaild response \"") + line + "\"" + "," + QObject::tr("authentication will be canceld"), NOTIFY);
showMessage(QObject::tr("AUTHENTICATION CANCELED"), START);
exit(BIO_FAILED);
}
int i = 0;
for(auto type : devicesMap.keys()) {
int size = devicesMap[type].size();
if(i + size >= deviceIndex) {
return devicesMap[type][deviceIndex - i - 1];
}
i += size;
}
return DeviceInfo();
}
static void signal_handler(int signo)
{
if (signo == SIGHUP) {
bioAuth.stopAuth();
}
}
int main(int argc, char *argv[])
{
QCoreApplication::setSetuidAllowed(true);
QCoreApplication a(argc, argv);
QString locale = QLocale::system().name();
QTranslator translator, translator_bin;
QString qmfile = QString("%1/i18n_qm/%2.qm").arg(GET_STR(UKUI_BIOMETRIC)).arg(locale);
QString qmfile_bin = QString("%1/i18n_qm/bioauth-bin/%2.qm").arg(GET_STR(UKUI_BIOMETRIC)).arg(locale);
qDebug() << "load translation file " << qmfile << qmfile_bin;
translator.load(qmfile);
translator_bin.load((qmfile_bin));
a.installTranslator(&translator);
a.installTranslator(&translator_bin);
QCommandLineParser parser;
QCommandLineOption serviceOption({"s", "service"}, QObject::tr("Sevice Name"), "service", "");
QCommandLineOption displayOption({"x", "display"}, QObject::tr("DISPLAY env"), "display", ":0");
QCommandLineOption usernameOption({"u", "user"}, QObject::tr("User"), "user", "");
QCommandLineOption debugOption({"d", "debug"}, QObject::tr("Display debug information"));
QCommandLineOption deviceOption({"e", "device"}, QObject::tr("Device short name"), "");
parser.addOptions({serviceOption, displayOption, usernameOption, debugOption, deviceOption});
parser.process(a);
if(parser.isSet(debugOption))
enableDebug = true;
else
enableDebug = false;
logPrefix = "[pam-diaglog]:";
qInstallMessageHandler(outputMessage);
QString serverName = parser.value(serviceOption);
if (serverName == "sudo" && isQuickInput()) {
exit(BIO_ERROR);
}
QString userName = parser.value(usernameOption);
if(userName.isEmpty())
exit(BIO_ERROR);
qDebug() << "authentication user: " << userName;
uid_t uid;
struct passwd *pwd = getpwnam(userName.toLocal8Bit().data());
if(pwd)
uid = pwd->pw_uid;
else
exit(BIO_ERROR);
BioDevices bioDevices(true);
bioDevices.setUId(uid);
int maxFailedTimes = bioDevices.getFailedTimes();
DeviceInfoPtr deviceInfo = bioDevices.getDefaultDevice(uid);
bool isHiddenSwitchButton = bioDevices.GetHiddenSwitchButton();
if(!deviceInfo){ // 只检查默认设备,不再使用第一个设备
exit(BIO_ERROR);
}
if(bioDevices.getFeatureCount(uid)<1)
exit(BIO_ERROR);
if(deviceInfo->biotype == 6){
showMessage(QObject::tr("UKEY AUTHENTICATION"), START);
}else{
showMessage(QObject::tr("BIOMETRIC AUTHENTICATION"), START);
if(!isHiddenSwitchButton)
showMessage(QObject::tr("Press Q or Esc to cancel"), PROMPT);
}
bioAuth.setUid(uid);
bioAuth.setDevice(deviceInfo);
KeyWatcher watcher;
QMap m_failedTimes;
QObject::connect(&bioAuth, &BioAuth::notify, &a, [&](const QString &msg){
showMessage(msg, NOTIFY);
});
QObject::connect(&bioAuth, &BioAuth::authComplete, &a, [&](uid_t uid_, int result, int retErrNo){
Q_UNUSED(retErrNo);
watcher.stop();
bool isBioEnable = bioDevices.GetBioAuthEnable(uid_);
bool isUkeyDevice = false;
if(deviceInfo && deviceInfo->biotype == 6){
isUkeyDevice = true;
}
if(!isBioEnable && !isUkeyDevice){
showMessage(QObject::tr("BIOMETRIC AUTHENTICATION IS CLOSED"), RESULT);
exit(BIO_IGNORE);
}
if(result && uid == uid_) {
showMessage(QObject::tr("AUTHENTICATION SUCCESS"), RESULT);
exit(BIO_SUCCESS);
}
else {
showMessage(QObject::tr("AUTHENTICATION FAILED"), RESULT);
DeviceInfoPtr curDeviceInfo = bioAuth.getDevice();
if (m_failedTimes.contains(deviceInfo->device_id)) {
m_failedTimes[curDeviceInfo->device_id] = m_failedTimes[curDeviceInfo->device_id] + 1;
} else {
m_failedTimes[curDeviceInfo->device_id] = 1;
}
if(m_failedTimes[curDeviceInfo->device_id]biotype)).arg(maxFailedTimes-m_failedTimes[deviceInfo->device_id]),RESULT);
}else{
showMessage(QObject::tr("Unable to verify %1, please enter password.").arg(bioDevices.bioTypeToString_tr(curDeviceInfo->biotype)),RESULT);
exit(BIO_IGNORE);
}
Option option = showOption(bioDevices.getAllDevices().count() > 1);
switch(option) {
case OPTION_TRY_AGAIN:
if(deviceInfo->biotype == 6){
QString code = inputPinCode();
bioAuth.SetExtraInfo("pincode",code);
}
bioAuth.startAuth();
watcher.start();
break;
case OPTION_SELECT_DEVICE:
{
deviceInfo = std::make_shared();
*deviceInfo = showDevices(bioDevices.getAllDevices());
bioAuth.setDevice(deviceInfo);
if(deviceInfo->biotype == 6){
QString code = inputPinCode();
bioAuth.SetExtraInfo("pincode",code);
}
bioAuth.startAuth();
watcher.start();
break;
}
case OPTION_CANCEL:
if(isHiddenSwitchButton)
{
exit(BIO_ERROR);
}else{
if(deviceInfo->biotype == 6){
showMessage(QObject::tr("AUTHENTICATION END"), START);
}else{
showMessage(QObject::tr("BIOMETRIC AUTHENTICATION END"), START);
}
exit(BIO_IGNORE);
break;
}
default:
break;
}
}
});
if(deviceInfo->biotype == 6){
QString code = inputPinCode();
bioAuth.SetExtraInfo("pincode",code);
}
bioAuth.startAuth();
if (!isHiddenSwitchButton) {
QObject::connect(&watcher, &KeyWatcher::exit, &a, [&]{
showMessage(QObject::tr("AUTHENTICATION CANCELED"), START);
bioAuth.stopAuth();
exit(BIO_IGNORE);
});
}
watcher.start();
signal(SIGHUP, signal_handler);
return a.exec();
}
ukui-biometric-auth/bioauth-bin/src/keywatcher.h 0000664 0001750 0001750 00000001762 15167732630 020716 0 ustar feng feng /*
* Copyright (C) 2023 KylinSoftCo., 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 .
*
**/
#ifndef KEYWATCHER_H
#define KEYWATCHER_H
#include
#include
class KeyWatcher : public QThread
{
Q_OBJECT
public:
explicit KeyWatcher(QObject *parent = nullptr);
void run() override;
void stop();
signals:
void exit();
private:
struct termios save;
};
#endif // KEYWATCHER_H
ukui-biometric-auth/bioauth-bin/CMakeLists.txt 0000664 0001750 0001750 00000002223 15167732644 020346 0 ustar feng feng project(bioauth-bin)
set(CMAKE_AUTOMOC ON)
# 定义源文件
set(bin_SRCS
src/main.cpp
src/keywatcher.cpp
../common/generic.cpp
)
# 根据Qt版本设置包含目录和链接库
if(QT_VERSION_MAJOR EQUAL 6)
include_directories(
../common
../bioauth/include
${Qt6Core_INCLUDE_DIRS}
${Qt6DBus_INCLUDE_DIRS}
)
add_executable(bioauth ${bin_SRCS})
target_link_libraries(bioauth Qt6::Core BioAuth)
else()
include_directories(
../common
../bioauth/include
${Qt5Core_INCLUDE_DIRS}
${Qt5DBus_INCLUDE_DIRS}
)
add_executable(bioauth ${bin_SRCS})
target_link_libraries(bioauth Qt5::Core BioAuth)
endif()
install(TARGETS bioauth DESTINATION bin)
file(GLOB ts_files i18n_ts/*.ts)
# 根据Qt版本使用相应的翻译函数
if(QT_VERSION_MAJOR EQUAL 6)
qt6_add_translation(qm_files ${ts_files})
else()
qt5_add_translation(qm_files ${ts_files})
endif()
add_custom_target(bioauth-bin_i18n DEPENDS ${qm_files} SOURCES ${ts_files})
add_dependencies(bioauth bioauth-bin_i18n)
install(FILES ${qm_files} DESTINATION ${UKUI_BIOMETRIC_DIR}/i18n_qm/bioauth-bin)
ukui-biometric-auth/bioauth-bin/i18n_ts/ 0000775 0001750 0001750 00000000000 15167732644 017074 5 ustar feng feng ukui-biometric-auth/bioauth-bin/i18n_ts/ru.ts 0000664 0001750 0001750 00000012062 15167732644 020073 0 ustar feng feng
BioDevices
FingerPrint
FingerPrint
FingerVein
FingerVein
Iris
Ирис
Face
Лицо
VoicePrint
Voiceprint
QObject
Try it again
Попробуйте снова
Use other Devices
Использовать другие устройства
Cancel
Отмена
Choose the option
Выберите вариант
Invaild response "
Invaild response \ "
AUTHENTICATION CANCELED
АВТОРИЗАЦИЯ ОТМЕНА
=== BIOMETRIC DEVICES ===
=== БИОМЕТРИЧЕСКИЕ УСТРОЙСТВА ===
Choose the device
Выберите устройство
Sevice Name
Имя ячейки
DISPLAY env
DISPLAY env
User
пользователь
Display debug information
Отображать отладочную информацию
Device short name
Краткое название устройства
BIOMETRIC AUTHENTICATION
БИОМЕТРИЧЕСКАЯ АУТЕНТИФИКАЦИЯ
Press Q or Esc to cancel
Нажмите Q или Esc, чтобы отменить
AUTHENTICATION SUCCESS
УСПЕХ АУТЕНТИФИКАЦИИ
AUTHENTICATION FAILED
АВТОРИЗАЦИЯ НЕИСПРАВНО
BIOMETRIC AUTHENTICATION END
КОНТРОЛЬ БИОМЕТРИЧЕСКОЙ АВТОРИЗАЦИИ
authentication will be canceld
Failed to verify %1, you still have %2 verification opportunities
Unable to verify %1, please enter password.
Enter the ukey password
UKEY AUTHENTICATION
BIOMETRIC AUTHENTICATION IS CLOSED
AUTHENTICATION END
ukui-biometric-auth/bioauth-bin/i18n_ts/de.ts 0000664 0001750 0001750 00000025472 15167732644 020046 0 ustar feng feng
BioAuthWidget
More
更多
Retry
wiederholen
Too many unsuccessful attempts,please enter password.
验证失败达最大次数,请使用密码解锁
Bioauth authentication failed, you still have %1 verification opportunities
生物认证失败,您还有%1次尝试机会
Password
Passwort
Current Device:
当前设备:
%1 too many unsuccessful attempts,please enter password.
%1 Es gibt zu viele fehlgeschlagene Versuche, bitte geben Sie Ihr Passwort ein.
%1 authentication failure,there are still %2 remaining opportunities
%1 Authentifizierung fehlgeschlagen und es sind noch %2 verbleibende Chancen
Please use wechat to scan the code
Bitte verwenden Sie WeChat, um den Code zu scannen
BioDevices
Unplugging of %1 device detected
Das %1-Gerät wurde vom Stromnetz getrennt
%1 device insertion detected
%1 angeschlossenes Gerät erkannt
ukui-biometric-manager
Tools für die biometrische Verwaltung
biometric
Biologische Eigenschaften
FingerPrint
Fingerabdruck
FingerVein
Fingervenen
Iris
Iris
Face
Gesichtserkennung
VoicePrint
Stimmenausdruck
ukey
Sicherheitsschlüssel
QRCode
QR-Code
Wechat
微信
BioDevicesWidget
Device types:
设备类型:
Back
返回
OK
确定
FingerPrint
指纹
LoginOptionsWidget
Login Options
Anmeldeoptionen
Password
Passwort
Wechat
微信
Biometric
生物识别
QObject
FingerPrint
指纹
FingerVein
指静脉
Iris
虹膜
Face
人脸
VoicePrint
声纹
Enter the ukey password
Try it again
Use other Devices
Cancel
Choose the option
Invaild response "
authentication will be canceld
AUTHENTICATION CANCELED
=== BIOMETRIC DEVICES ===
Choose the device
Sevice Name
DISPLAY env
User
Display debug information
Device short name
UKEY AUTHENTICATION
BIOMETRIC AUTHENTICATION
Press Q or Esc to cancel
BIOMETRIC AUTHENTICATION IS CLOSED
AUTHENTICATION SUCCESS
AUTHENTICATION FAILED
Failed to verify %1, you still have %2 verification opportunities
Unable to verify %1, please enter password.
AUTHENTICATION END
BIOMETRIC AUTHENTICATION END
ukui-biometric-auth/bioauth-bin/i18n_ts/ky.ts 0000664 0001750 0001750 00000027551 15167732644 020101 0 ustar feng feng
BioAuthWidget
More
更多
Retry
Ретри
Too many unsuccessful attempts,please enter password.
验证失败达最大次数,请使用密码解锁
Bioauth authentication failed, you still have %1 verification opportunities
生物认证失败,您还有%1次尝试机会
Password
Сырсөз
Current Device:
当前设备:
%1 too many unsuccessful attempts,please enter password.
%1 өтө көп ийгиликсиз аракеттер,, сураныч, сырсөз киргизүү.
%1 authentication failure,there are still %2 remaining opportunities
%1 аутентификациялык жетишсиздик,дагы эле %2 калган мүмкүнчүлүктөр бар
Please use wechat to scan the code
Кодду сканерлеу үчүн вечат колдонуңуз
BioDevices
Unplugging of %1 device detected
%1 орнотмосунун өчүрүлүшү аныкталды
%1 device insertion detected
%1 түзмөк орнотмосу аныкталды
ukui-biometric-manager
укуи-биометриялык-менеджери
biometric
биометрия
FingerPrint
Манжа изи
FingerVein
Манжавейн
Iris
Ирис
Face
Бет
VoicePrint
VoicePrint
ukey
уики
QRCode
QRCode
Wechat
微信
BioDevicesWidget
Device types:
设备类型:
Back
返回
OK
确定
FingerPrint
指纹
LoginOptionsWidget
Login Options
Кирүү параметрлери
Password
Сырсөз
Wechat
微信
Biometric
生物识别
QObject
FingerPrint
指纹
FingerVein
指静脉
Iris
虹膜
Face
人脸
VoicePrint
声纹
Enter the ukey password
ukey جاشىرۇۇن نومۇرۇن كىرگىزىڭ
Try it again
قايرا سىناڭ
Use other Devices
باشقا شايمان ىشتەتىش
Cancel
ارعادان قالتىرىش
Choose the option
تانداش تۉرۉ
Invaild response "
ۅنۉمسۉز ىنكاس
authentication will be canceld
اتۇۇلدۇق تەكشەرىش ارعادان قالتىرلات
AUTHENTICATION CANCELED
اتۇۇلدۇق تەكشەرىش ارعادان قالتىرىلدى
=== BIOMETRIC DEVICES ===
= = = بىيولوگىيەلىك ايىرمالاندىرىش جابدۇۇسۇ = = =
Choose the device
باشقا شايمان تانداڭ
Sevice Name
تەيلۅۅ ناامى
DISPLAY env
كۅرسۅتۉۉ چۅيرۅسۉ
User
كەرەكتۅۅچۉ ناامى
Display debug information
تەڭشۅۅ ۇچۇردۇ كۅرسۅتۉۉ
Device short name
جابدۇۇسۇنۇن قىسقا ناامى
UKEY AUTHENTICATION
UKEY تولۇمدۇۇلۇق دالىلدۅ
BIOMETRIC AUTHENTICATION
بىيولوگىيەلىك ۅزگۅچۅلۉك ىسپاتى
Press Q or Esc to cancel
Q كۅرۉنۉشتۅرۉ Esc نى باسىپ ارعادان قالتىرىڭ
BIOMETRIC AUTHENTICATION IS CLOSED
بىئولوگىيەلىك ۅزگۅچۅلۉگۉ دالىلدۅ تاقالدى
AUTHENTICATION SUCCESS
اتۇۇلدۇق تەكشەرىش جەڭىشتۉۉ بولدۇ
AUTHENTICATION FAILED
اتۇۇلدۇق تەكشەرىش جەڭىلۉۉ بولدۇ .
Failed to verify %1, you still have %2 verification opportunities
٪1 نى دالىلدۅ جەڭىلۉۉ بولدۇ ، سىزدە داعى ەلە ٪2 دالىلدۅ مۅۅرتۉ بار
Unable to verify %1, please enter password.
%1 نى دالىلدەگەلى بولبويت ، جاشىرۇۇن نومۇردۇ كىرگىزىڭ.
AUTHENTICATION END
اتۇۇلدۇق تەكشەرىش سوڭۇنا چىقتى.
BIOMETRIC AUTHENTICATION END
بىئولوگىيەلىك ۅزگۅچۅلۉك ىسپات بەرۉۉ ۇچۇ
ukui-biometric-auth/bioauth-bin/i18n_ts/zh_CN.ts 0000664 0001750 0001750 00000013747 15167732644 020461 0 ustar feng feng
QObject
Enter the ukey password
输入ukey密码
Enter the ukey password
输入ukey密码\n
Try it again
再试一次
Use other Devices
使用其他设备
Cancel
取消
Choose the option
选择选项
Invaild response "
不能识别的响应 "
authentication will be canceld
认证将要被取消
AUTHENTICATION CANCELED
认证被取消
=== BIOMETRIC DEVICES ===
=== 生物识别设备 ===
Choose the device
选择设备
Sevice Name
DISPLAY env
User
Display debug information
Device short name
UKEY AUTHENTICATION
ukey认证
BIOMETRIC AUTHENTICATION
生物识别认证
Press Q or Esc to cancel
按Q或者Esc取消
BIOMETRIC AUTHENTICATION IS CLOSED
生物识别认证已关闭
AUTHENTICATION SUCCESS
认证成功
AUTHENTICATION FAILED
认证失败
Failed to verify %1, you still have %2 verification opportunities
验证%1失败,您还有%2次尝试机会
Unable to verify %1, please enter password.
无法验证%1,请输入密码.
AUTHENTICATION END
认证结束
BIOMETRIC AUTHENTICATION END
生物识别认证结束
ukui-biometric-auth/bioauth-bin/i18n_ts/kk.ts 0000664 0001750 0001750 00000030075 15167732644 020056 0 ustar feng feng
BioAuthWidget
Form
Пішін
More
更多
Retry
ретри
Too many unsuccessful attempts,please enter password.
验证失败达最大次数,请使用密码解锁
Bioauth authentication failed, you still have %1 verification opportunities
生物认证失败,您还有%1次尝试机会
Password
құпиясөз
Current Device:
当前设备:
%1 too many unsuccessful attempts,please enter password.
% 1 Қате әрекеттер тым көп, құпия сөзіңізді енгізіңіз.
%1 authentication failure,there are still %2 remaining opportunities
% 1 аутентификациясы жаңылысқан және әлі де% 2 мүмкіндігі бар
Please use wechat to scan the code
Кодты сканерлеу үшін WeChat пайдалануыңызды сұраймын
BioDevices
Unplugging of %1 device detected
% 1 құрылғы ажыратылды
%1 device insertion detected
% 1 құрылғы анықталды
ukui-biometric-manager
Биометриялық басқару құралдары
biometric
Биологиялық сипаттамалары
FingerPrint
саусақ ізі
FingerVein
Саусақ көктамырлары
Iris
ирис
Face
Бет тану
VoicePrint
Дауыстық із
ukey
Қауіпсіздік кілттері
QRCode
QR коды
Wechat
微信
BioDevicesWidget
Form
Пішін
Device types:
设备类型:
Back
返回
OK
确定
FingerPrint
指纹
LoginOptionsWidget
Login Options
Кіру параметрлері
Password
құпиясөз
Wechat
微信
Biometric
生物识别
QObject
FingerPrint
指纹
FingerVein
指静脉
Iris
虹膜
Face
人脸
VoicePrint
声纹
Enter the ukey password
ukey قۇپيا نۇمىردى كىرگىزىڭىز
Try it again
قاتە سىناڭ
Use other Devices
باسقا اسباب ٸستەتۋ
Cancel
كۇشىنەن قالدىرۋ
Choose the option
تالداۋ تۇرى
Invaild response "
ونٸمسٸز جاۋاپ
authentication will be canceld
ازاماتتىق تەكسەرۋ كۇشىنەن قالدىرىلدى
AUTHENTICATION CANCELED
ازاماتتىق تەكسەرۋ كۇشىنەن قالدىرىلدى
=== BIOMETRIC DEVICES ===
= = = بىيولوگىيەلىك پارىقتاندىرۋ اسپابٸ = = =
Choose the device
باسقا اسباب تالدا
Sevice Name
قىزىمەت مى
DISPLAY env
كورسەتۋ ورتا
User
الارمان مى
Display debug information
تەڭشەۋ حاباردٸ كورسەتۋ
Device short name
اسبابٸتٸڭ قىسقا مى
UKEY AUTHENTICATION
UKEY سالاۋاتىن دالەلدەۋ
BIOMETRIC AUTHENTICATION
بىيولوگىيەلىك ەرەكشەلىك كۋالٸكتٸ
Press Q or Esc to cancel
Q ياكي Esc نى باسٸپ كۇشىنەن قالدىرىڭ
BIOMETRIC AUTHENTICATION IS CLOSED
بىئولوگىيەلىك ەرەكشەلىكتى دالەلدەۋ جابٸلدٸ
AUTHENTICATION SUCCESS
ازاماتتىق تەكسەرۋ ناتيجەلى قالدى
AUTHENTICATION FAILED
ازاماتتىق تەكسەرۋ جەڭىلىپ قالدى.
Failed to verify %1, you still have %2 verification opportunities
٪1 نى دالەلدەۋ جەڭىلىپ قالدى، سىزدە جانەدە ٪2 دالەلدەۋ ورايى بار
Unable to verify %1, please enter password.
%1 نى دالەلى بولمايدى، قۇپيا نۇمىردى كىرگىزىڭىز.
AUTHENTICATION END
ازاماتتىق تەكسەرۋ اياقتاتادى.
BIOMETRIC AUTHENTICATION END
بىئولوگىيەلىك ەرەكشەلىك دالەل بەرۋ ۇشى
ukui-biometric-auth/bioauth-bin/i18n_ts/tr.ts 0000664 0001750 0001750 00000015124 15167732644 020074 0 ustar feng feng
BioDevices
FingerPrint
Parmak İzi
FingerVein
Damar İzi
Iris
Göz
Face
Yüz Tanıma
VoicePrint
Ses İzi
QObject
Enter the ukey password
Try it again
Yeniden Dene
Use other Devices
Diğer Cihazları Kullan
Cancel
İptal
Choose the option
Seçeneği seçin
Invaild response "
Geçersiz cevap "
authentication will be canceld
AUTHENTICATION CANCELED
KİMLİK DOĞRULAMA
=== BIOMETRIC DEVICES ===
=== BİYOMETRİK CİHAZLAR ===
Choose the device
Cihazı seçin
Sevice Name
Servis Adı
DISPLAY env
EKRAN env
User
Kullanıcı
Display debug information
Hata ayıklama bilgilerini görüntüle
Device short name
Cihaz kısa adı
UKEY AUTHENTICATION
BIOMETRIC AUTHENTICATION
BİYOMETRİK KİMLİK DOĞRULAMA
Press Q or Esc to cancel
İptal etmek için Q veya Esc tuşuna basın
BIOMETRIC AUTHENTICATION IS CLOSED
AUTHENTICATION SUCCESS
KİMLİK DOĞRULAMA
AUTHENTICATION FAILED
KİMLİK DOĞRULAMA BAŞARISIZ OLDU
Failed to verify %1, you still have %2 verification opportunities
Unable to verify %1, please enter password.
AUTHENTICATION END
BIOMETRIC AUTHENTICATION END
BİYOMETRİK KİMLİK DOĞRULAMA SONU
ukui-biometric-auth/bioauth-bin/i18n_ts/bo.ts 0000664 0001750 0001750 00000013475 15167732644 020056 0 ustar feng feng
QObject
Enter the ukey password
Try it again
Use other Devices
Cancel
Choose the option
Invaild response "
authentication will be canceld
AUTHENTICATION CANCELED
=== BIOMETRIC DEVICES ===
Choose the device
Sevice Name
DISPLAY env
User
Display debug information
Device short name
UKEY AUTHENTICATION
BIOMETRIC AUTHENTICATION
Press Q or Esc to cancel
BIOMETRIC AUTHENTICATION IS CLOSED
AUTHENTICATION SUCCESS
AUTHENTICATION FAILED
Failed to verify %1, you still have %2 verification opportunities
Unable to verify %1, please enter password.
AUTHENTICATION END
BIOMETRIC AUTHENTICATION END
ukui-biometric-auth/bioauth-bin/i18n_ts/ug.ts 0000664 0001750 0001750 00000030225 15167732644 020061 0 ustar feng feng
BioAuthWidget
More
更多
Retry
قايتا سىناپ بىقىڭ
Too many unsuccessful attempts,please enter password.
验证失败达最大次数,请使用密码解锁
Bioauth authentication failed, you still have %1 verification opportunities
生物认证失败,您还有%1次尝试机会
Password
مەخپىي نومۇر
Current Device:
当前设备:
%1 too many unsuccessful attempts,please enter password.
1-نومۇر مەغلۇپ بولغان سىناق قېتىم سانى زىيادە كۆپ، مەخپىي نومۇرنى كىرگۈزۈڭ
%1 authentication failure,there are still %2 remaining opportunities
بىر كىملىك دەلىللەش مەغلۇپ بولدى، يەنىلا ٪2 ئېشىپ قالغان پۇرسەت بار
Please use wechat to scan the code
ئۈندىداردا كود سۈپۈرۈڭ
BioDevices
Unplugging of %1 device detected
تەكشۈرۈپ بايقىغان 1 ئۈسكۈنىنى تارتىپ چىقارماق
%1 device insertion detected
٪1 ئۈسكۈنىنىڭ كىرگۈزۈلگەنلىكىنى تەكشۈرۈپ چىقماق
ukui-biometric-manager
بىئولوگىيەلىك ئالاھىدىلىك باشقۇرۇش قورالى
biometric
بىئولوگىيەلىك ئالاھىدىلىك
FingerPrint
بارماق ئىزى
FingerVein
ۋېنانى كۆرسىتىدۇ
Iris
رەڭدار پەردە
Face
ئادەم يۈزىنى پەرقلەندۈرۈش
VoicePrint
ئاۋاز سىزىقى
ukey
بىخەتەر ئاچقۇچ
QRCode
ئىككى ئۆلچەملىك كود
Wechat
微信
BioDevicesWidget
Device types:
设备类型:
Back
返回
OK
确定
FingerPrint
指纹
LoginOptionsWidget
Login Options
تاللاش تۈرىگە كىرمەك
Password
مەخپىي نومۇر
Wechat
微信
Biometric
生物识别
QObject
FingerPrint
指纹
FingerVein
指静脉
Iris
虹膜
Face
人脸
VoicePrint
声纹
Enter the ukey password
ukey مەخپىي نومۇرىنى كىرگۈزۈڭ
Try it again
قايتا سىناڭ
Use other Devices
باشقا ئۈسكۈنە ئىشلىتىش
Cancel
ئەمەلدىن قالدۇرۇش
Choose the option
تاللاش تۈرى
Invaild response "
ئۈنۈمسىز ئىنكاس
authentication will be canceld
سالاھىيەت تەكشۈرۈش ئەمەلدىن قالدۇرۇلىدۇ
AUTHENTICATION CANCELED
سالاھىيەت تەكشۈرۈش ئەمەلدىن قالدۇرۇلدى
=== BIOMETRIC DEVICES ===
= = = بىيولوگىيەلىك پەرقلەندۈرۈش ئۈسكۈنىسى = = =
Choose the device
باشقا ئۈسكۈنە تاللاڭ
Sevice Name
مۇلازىمەت نامى
DISPLAY env
كۆرسىتىش مۇھىتى
User
ئىشلەتكۈچى
Display debug information
تەڭشەش ئۇچۇرىنى كۆرسىتىش
Device short name
ئۈسكۈنىنىڭ قىسقا نامى
UKEY AUTHENTICATION
UKEY سالاھىيىتىنى دەلىللەش
BIOMETRIC AUTHENTICATION
بىيولوگىيەلىك ئالاھىدىلىك ئىسپاتى
Press Q or Esc to cancel
Q ياكى Esc نى بېسىپ ئەمەلدىن قالدۇرۇڭ
BIOMETRIC AUTHENTICATION IS CLOSED
بىئولوگىيەلىك ئالاھىدىلىكنى دەلىللەش تاقالدى
AUTHENTICATION SUCCESS
سالاھىيەت تەكشۈرۈش مۇۋەپپەقىيەتلىك بولدى
AUTHENTICATION FAILED
سالاھىيەت تەكشۈرۈش مەغلۇپ بولدى.
Failed to verify %1, you still have %2 verification opportunities
٪1 دەلىللەش مەغلۇپ بولدى، سىزدە يەنە ٪2 دەلىللەش پۇرسىتى بار
Unable to verify %1, please enter password.
%1 نى دەلىللىگىلى بولمايدۇ، مەخپىي نومۇرنى كىرگۈزۈڭ.
AUTHENTICATION END
سالاھىيەت تەكشۈرۈش ئاخىرلاشتى.
BIOMETRIC AUTHENTICATION END
بىئولوگىيەلىك ئالاھىدىلىك ئىسپات بېرىش ئۇچى
ukui-biometric-auth/bioauth-bin/i18n_ts/pt.ts 0000664 0001750 0001750 00000011406 15167732644 020071 0 ustar feng feng
BioDevices
FingerPrint
Impressão digital
FingerVein
FingerVein
Iris
Íris
Face
Cara
VoicePrint
VoicePrint
QObject
Try it again
Tente de novo
Use other Devices
Use outros dispositivos
Cancel
Cancelar
Choose the option
Escolha a opção
Invaild response "
Resposta Inválida \ "
AUTHENTICATION CANCELED
AUTENTICAÇÃO CANCELADA
=== BIOMETRIC DEVICES ===
=== DISPOSITIVOS BIOMÉTRICOS ===
Choose the device
Escolha o dispositivo
Sevice Name
Nome do Sevice
DISPLAY env
DISPLAY env
User
Do utilizador
Display debug information
Exibir informações de depuração
Device short name
Nome abreviado do dispositivo
BIOMETRIC AUTHENTICATION
AUTENTICAÇÃO BIOMÉTRICA
Press Q or Esc to cancel
Pressione Q ou Esc para cancelar
AUTHENTICATION SUCCESS
SUCESSO DE AUTENTICAÇÃO
AUTHENTICATION FAILED
AUTENTICAÇÃO FALHOU
BIOMETRIC AUTHENTICATION END
ENDEREÇO DE AUTENTICAÇÃO BIOMÉTRICA
authentication will be canceld
Failed to verify %1, you still have %2 verification opportunities
Unable to verify %1, please enter password.
Enter the ukey password
UKEY AUTHENTICATION
BIOMETRIC AUTHENTICATION IS CLOSED
AUTHENTICATION END
ukui-biometric-auth/bioauth-bin/i18n_ts/bo_CN.ts 0000664 0001750 0001750 00000013613 15167732644 020430 0 ustar feng feng
QObject
DISPLAY env
Choose the option
གདམ་བྱ་འདེམ་པ།
=== BIOMETRIC DEVICES ===
=== སྐྱེ་དངོས་ངོས་འཛིན་སྒྲིག་ཆས། ===
Display debug information
བསྒྱུར་བཅོས་ཆ་འཕྲིན་མངོན་དུ་བཅུག་པ།
Invaild response "
ནུས་མེད་ཀྱི་དང་ལེན་ཨང་།
AUTHENTICATION SUCCESS
བདེན་དཔང་ངོས་འཛིན་ལེགས་གྲུབ།
Try it again
ཡང་བསྐྱར་ཚོད་ལྟ་ཐེངས་གཅིག
Cancel
མེད་པར་བཟོ་བ
authentication will be canceld
བདེན་དཔང་ངོས་འཛིན་མི་འགྱངས་པར་རྩིས་མེད་གཏོང་།
AUTHENTICATION CANCELED
བདེན་དཔང་ངོས་འཛིན་རྩིས་མེད་གཏོང་།
Sevice Name
ཞབས་ཞུའི་མིང་།
Press Q or Esc to cancel
Qམནན་པའམEscརྩིས་མེད།
BIOMETRIC AUTHENTICATION
སྐྱེ་དངོས་བརྟག་དཔྱད་བདེན་དཔང་ངོས་འཛིན།
AUTHENTICATION FAILED
བདེན་དཔང་ངོས་འཛིན་ཕམ་ཉེས་བྱུང་།
Use other Devices
སྒྲིག་ཆས་གཞན་བེད་སྤྱོད་བཏང་།
BIOMETRIC AUTHENTICATION END
སྐྱེ་དངོས་བརྟག་དཔྱད་བདེན་དཔང་ངོས་འཛིན་མཇུག་སྒྲིལ།
Choose the device
སྒྲིག་ཆས་འདེམ་པ།
User
སྤྱོད་མཁན།
Device short name
སྒྲིག་ཆས་ཀྱི་བསྡུས་མིང་།
Failed to verify %1, you still have %2 verification opportunities
ཚོད་ལྟས་ར་སྤྲོད་%1ཕམ་ཉེས་བྱུང་།ཁྱེད་རང་ད་དུང་ཡོད།%2ཚོད་ལྟ་བྱེད་པའི་གོ་སྐབས་ཤིག་རེད།
Unable to verify %1, please enter password.
ཚོད་ལྟས་ར་སྤྲོད་བྱེད་ཐབས་མེད%1,ཁྱོད་ཀྱིས་གསང་གྲངས་ནང་འཇུག་བྱེད་རོགས།
UKEY AUTHENTICATION
བདེ་འཇགས་ཀྱི་གསང་བའི་བདེན་དཔང་ར་སྤྲོད།
BIOMETRIC AUTHENTICATION IS CLOSED
སྐྱེ་དངོས་ཀྱི་ངོས་འཛིན་ཁས་ལེན་བྱས་པ་སྒོ་བརྒྱབ་ཟིན།
AUTHENTICATION END
བདེན་དཔང་ར་སྤྲོད་མཇུག་བསྒྲི
Enter the ukey password
བདེ་འཇགས་ཀྱི་གསང་བའི་གསང་བའི་ཨང་གྲངས་ནང་འཇུག་བྱེད་དགོས།
ukui-biometric-auth/bioauth-bin/i18n_ts/vi.ts 0000664 0001750 0001750 00000014307 15167732644 020067 0 ustar feng feng
QObject
Enter the ukey password
Nhập mật khẩu UKey
Enter the ukey password
Nhập mật khẩu ukey
Try it again
Thử lại một lần nữa
Use other Devices
Sử dụng thiết bị khác
Cancel
Hủy
Choose the option
Chọn tùy chọn
Invaild response "
Phản hồi Invaild "
authentication will be canceld
Xác thực sẽ bị hủy bỏ
AUTHENTICATION CANCELED
XÁC THỰC BỊ HỦY
=== BIOMETRIC DEVICES ===
=== THIẾT BỊ SINH TRẮC HỌC ===
Choose the device
Chọn thiết bị
Sevice Name
DISPLAY env
User
Tên người dùng
Display debug information
Device short name
Tên ngắn thiết bị
UKEY AUTHENTICATION
XÁC THỰC UKEY
BIOMETRIC AUTHENTICATION
XÁC THỰC SINH TRẮC HỌC
Press Q or Esc to cancel
Ấn Q hoặc Esc để hủy
BIOMETRIC AUTHENTICATION IS CLOSED
Xác thực sinh trắc học đã bị tắt
AUTHENTICATION SUCCESS
XÁC THỰC THÀNH CÔNG
AUTHENTICATION FAILED
Xác thực thất bại
Failed to verify %1, you still have %2 verification opportunities
Xác thực %1 thất bại,bạn còn %2 lần thử
Unable to verify %1, please enter password.
Không thể xác minh %1, vui lòng nhập mật khẩu.
AUTHENTICATION END
KẾT THÚC XÁC THỰC
BIOMETRIC AUTHENTICATION END
Xác thực sinh trắc học đã kết thúc
ukui-biometric-auth/bioauth-bin/i18n_ts/mn.ts 0000664 0001750 0001750 00000032310 15167732644 020055 0 ustar feng feng
BioAuthWidget
More
更多
Retry
ᠳᠠᠬᠢᠨ ᠲᠤᠷᠰᠢᠬᠤ
Too many unsuccessful attempts,please enter password.
验证失败达最大次数,请使用密码解锁
Bioauth authentication failed, you still have %1 verification opportunities
生物认证失败,您还有%1次尝试机会
Password
ᠨᠢᠭᠤᠴᠠ ᠺᠣᠳ᠋
Current Device:
当前设备:
%1 too many unsuccessful attempts,please enter password.
%1 ᠢᠯᠠᠭᠳᠠᠭᠰᠠᠨ ᠲᠤᠷᠰᠢᠬᠤ ᠤᠳᠠᠭᠠ ᠲᠣᠭᠠ ᠬᠡᠳᠦ ᠣᠯᠠᠨ ᠂ ᠨᠢᠭᠤᠴᠠ ᠺᠣᠳ᠋ ᠣᠷᠣᠭᠤᠯᠤᠭᠠᠷᠠᠢ ᠃
%1 authentication failure,there are still %2 remaining opportunities
%1 ᠪᠡᠶᠡᠶ᠋ᠢᠨ ᠬᠢᠷᠢᠶ᠋ᠢᠨ ᠰᠢᠯᠭᠠᠨ ᠪᠠᠲᠤᠯᠠᠯᠲᠠ ᠢᠯᠠᠭᠳᠠᠪᠠ ᠂ ᠮᠥᠨ %2 ᠦᠯᠡᠳᠡᠬᠦ ᠲᠣᠬᠢᠶᠠᠯ ᠪᠣᠢ
Please use wechat to scan the code
ᠸᠢᠴᠠᠲᠢ᠋ᠶ᠋ᠠᠷ ᠦᠰᠦᠭ ᠰᠢᠷᠪᠢᠬᠦ ᠪᠣᠯᠪᠠᠤ
BioDevices
Unplugging of %1 device detected
%1 ᠲᠥᠬᠥᠭᠡᠷᠦᠮᠵᠢᠶ᠋ᠢ ᠰᠤᠭᠤᠯᠵᠤ ᠭᠠᠷᠭᠠᠨ ᠠ
%1 device insertion detected
%1 ᠲᠥᠬᠥᠭᠡᠷᠦᠮᠵᠢ ᠬᠠᠪᠴᠢᠭᠤᠯᠤᠭᠰᠠᠨᠢ᠋ ᠪᠠᠢᠴᠠᠭᠠᠨ ᠣᠯᠪᠠ
ukui-biometric-manager
ᠠᠮᠢᠳᠤ ᠪᠣᠳᠠᠰᠤ᠋ᠨ ᠣᠨᠴᠠᠯᠢᠭ ᠬᠠᠮᠢᠶᠠᠷᠤᠯᠲᠠᠶ᠋ᠢᠨ ᠪᠠᠭᠠᠵᠢ
biometric
ᠠᠮᠢᠳᠤ ᠪᠣᠳᠠᠰᠤ᠋ᠨ ᠣᠨᠴᠠᠯᠢᠭ
FingerPrint
ᠬᠤᠷᠤᠭᠤᠨ ᠬᠡ
FingerVein
ᠬᠤᠷᠤᠭᠤᠨ ᠨᠠᠮᠵᠢᠭᠤᠨ ᠰᠤᠳᠠᠰᠤ
Iris
ᠰᠣᠯᠣᠩᠭᠠ ᠪᠦᠷᠬᠦᠭᠦᠯ
Face
ᠬᠥᠮᠦᠨᠦ᠌ ᠨᠢᠭᠤᠷ ᠲᠠᠨᠢᠬᠤ
VoicePrint
ᠳᠠᠭᠤᠨ ᠡᠷᠢᠶᠡᠨ
ukey
ᠠᠶᠤᠯᠭᠦᠢ ᠨᠢᠭᠤᠴᠠ ᠲᠦᠯᠬᠢᠭᠦᠷ
QRCode
ᠬᠣᠶᠠᠷ ᠬᠡᠮᠵᠢᠯᠲᠦ ᠺᠣᠳ᠋
Wechat
微信
BioDevicesWidget
Device types:
设备类型:
Back
返回
OK
确定
FingerPrint
指纹
LoginOptionsWidget
Login Options
ᠲᠡᠮᠳᠡᠭᠯᠡᠬᠦ ᠰᠤᠩᠭᠤᠭᠳᠠᠬᠤᠨ
Password
ᠨᠢᠭᠤᠴᠠ ᠺᠣᠳ᠋
Wechat
微信
Biometric
生物识别
QObject
FingerPrint
指纹
FingerVein
指静脉
Iris
虹膜
Face
人脸
VoicePrint
声纹
Enter the ukey password
ukey ᠨᠢᠭᠤᠴᠠ ᠺᠣᠳ᠋ ᠢ᠋ ᠣᠷᠣᠭᠤᠯᠬᠤ
Try it again
ᠳᠠᠬᠢᠵᠤ ᠳᠤᠷᠰᠢᠬᠤ
Use other Devices
ᠪᠤᠰᠤᠳ ᠳᠦᠬᠦᠬᠡᠷᠦᠮᠵᠢ ᠵᠢ ᠬᠡᠷᠡᠭᠯᠡᠬᠦ
Cancel
ᠦᠬᠡᠢᠰᠬᠡᠬᠦ
Choose the option
ᠰᠤᠩᠭᠤᠭᠳᠠᠬᠤᠨ ᠢ᠋ ᠰᠣᠩᠭᠣᠬᠤ
Invaild response "
ᠢᠯᠭᠠᠨ ᠳᠠᠨᠢᠵᠤ ᠪᠣᠯᠬᠤ ᠥᠬᠡᠢ ᠳᠤᠰᠬᠠᠯ "
authentication will be canceld
ᠬᠡᠷᠡᠴᠢᠯᠡᠯ ᠤᠳᠠᠬᠤ ᠥᠬᠡᠢ ᠦᠬᠡᠢᠰᠬᠡᠭᠳᠡᠨᠡ
AUTHENTICATION CANCELED
ᠬᠡᠷᠡᠴᠢᠯᠡᠯ ᠦᠬᠡᠢᠰᠬᠡᠭᠳᠡᠪᠡ
=== BIOMETRIC DEVICES ===
=== ᠪᠢᠤᠯᠤᠬᠢ ᠵᠢᠨ ᠢᠯᠭᠠᠨ ᠳᠠᠨᠢᠬᠤ ᠳᠦᠬᠦᠬᠡᠷᠦᠮᠵᠢ===
Choose the device
ᠳᠦᠬᠦᠬᠡᠷᠦᠮᠵᠢ ᠰᠣᠩᠭᠣᠬᠤ
Sevice Name
Sevice Name
DISPLAY env
DISPLAY env
User
ᠬᠡᠷᠡᠭᠯᠡᠭᠴᠢ
Display debug information
ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠤᠭᠰᠠᠨ ᠰᠤᠷᠠᠭ ᠵᠠᠩᠬᠢ ᠢᠯᠡᠷᠡᠬᠦᠯᠬᠦ
Device short name
ᠨᠢᠭᠡ ᠳᠦᠬᠦᠬᠡᠷᠦᠮᠵᠢ ᠰᠤᠩᠭᠤᠨ ᠳᠤᠭᠳᠠᠭᠠᠭᠠᠷᠠᠢ
UKEY AUTHENTICATION
ukey ᠬᠡᠷᠡᠴᠢᠯᠡᠯ
BIOMETRIC AUTHENTICATION
ᠪᠢᠤᠯᠤᠬᠢ ᠵᠢ ᠢᠯᠭᠠᠨ ᠳᠠᠨᠢᠬᠤ ᠬᠡᠷᠡᠴᠢᠯᠡᠯ
Press Q or Esc to cancel
Q ᠪᠤᠶᠤEsc ᠢ᠋\ ᠵᠢ ᠳᠠᠷᠤᠵᠤ ᠦᠬᠡᠢᠰᠬᠡᠬᠦ
BIOMETRIC AUTHENTICATION IS CLOSED
ᠪᠢᠤᠯᠤᠬᠢ ᠵᠢ ᠢᠯᠭᠠᠨ ᠳᠠᠨᠢᠬᠤ ᠬᠡᠷᠡᠴᠢᠯᠡᠯ ᠢ᠋ ᠨᠢᠬᠡᠨᠳᠡ ᠬᠠᠭᠠᠪᠠ
AUTHENTICATION SUCCESS
ᠬᠡᠷᠡᠴᠢᠯᠡᠪᠡ
AUTHENTICATION FAILED
ᠬᠡᠷᠡᠴᠢᠯᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢ
Failed to verify %1, you still have %2 verification opportunities
%1 ᠢ᠋\ ᠵᠢ ᠪᠠᠳᠤᠯᠠᠭᠠᠵᠢᠭᠤᠯᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢ᠂ ᠲᠠ ᠪᠠᠰᠠ %2 ᠤᠳᠠᠭᠠᠨ ᠤ᠋ ᠳᠤᠷᠰᠢᠬᠤ ᠵᠠᠪᠰᠢᠶᠠᠨ ᠪᠤᠢ
Unable to verify %1, please enter password.
%1 ᠢ᠋\ ᠵᠢ ᠪᠠᠳᠤᠯᠠᠭᠠᠵᠢᠭᠤᠯᠬᠤ ᠵᠢᠨ ᠠᠷᠭᠠ ᠥᠬᠡᠢ᠂ ᠨᠢᠭᠤᠴᠠ ᠺᠣᠳ᠋ ᠵᠢᠨᠨ ᠤᠷᠤᠭᠤᠯᠤᠨᠠ ᠤᠤ᠃
AUTHENTICATION END
ᠬᠡᠷᠡᠴᠢᠯᠡᠯ ᠳᠠᠭᠤᠰᠪᠠ
BIOMETRIC AUTHENTICATION END
ᠪᠢᠤᠯᠤᠬᠢ ᠵᠢ ᠢᠯᠭᠠᠨ ᠳᠠᠨᠢᠬᠤ ᠬᠡᠷᠡᠴᠢᠯᠡᠯ ᠳᠠᠭᠤᠰᠪᠠ
ukui-biometric-auth/bioauth-bin/i18n_ts/fr.ts 0000664 0001750 0001750 00000026032 15167732644 020056 0 ustar feng feng
BioAuthWidget
Form
Forme
More
更多
Retry
réessayer
Too many unsuccessful attempts,please enter password.
验证失败达最大次数,请使用密码解锁
Bioauth authentication failed, you still have %1 verification opportunities
生物认证失败,您还有%1次尝试机会
Password
mot de passe
Current Device:
当前设备:
%1 too many unsuccessful attempts,please enter password.
%1 Il y a trop de tentatives infructueuses, veuillez saisir votre mot de passe.
%1 authentication failure,there are still %2 remaining opportunities
%1 authentification a échoué et il reste encore %2 chances
Please use wechat to scan the code
Veuillez utiliser WeChat pour scanner le code
BioDevices
Unplugging of %1 device detected
L’appareil %1 a été débranché
%1 device insertion detected
%1 périphérique branché détecté
ukui-biometric-manager
Outils de gestion biométrique
biometric
Caractéristiques biologiques
FingerPrint
empreinte digitale
FingerVein
Veines des doigts
Iris
iris
Face
Reconnaissance faciale
VoicePrint
Voiceprint
ukey
Clés de sécurité
QRCode
Code QR
Wechat
微信
BioDevicesWidget
Form
Forme
Device types:
设备类型:
Back
返回
OK
确定
FingerPrint
指纹
LoginOptionsWidget
Login Options
Options de connexion
Password
mot de passe
Wechat
微信
Biometric
生物识别
QObject
FingerPrint
指纹
FingerVein
指静脉
Iris
虹膜
Face
人脸
VoicePrint
声纹
Enter the ukey password
Try it again
Use other Devices
Cancel
Choose the option
Invaild response "
authentication will be canceld
AUTHENTICATION CANCELED
=== BIOMETRIC DEVICES ===
Choose the device
Sevice Name
DISPLAY env
User
Display debug information
Device short name
UKEY AUTHENTICATION
BIOMETRIC AUTHENTICATION
Press Q or Esc to cancel
BIOMETRIC AUTHENTICATION IS CLOSED
AUTHENTICATION SUCCESS
AUTHENTICATION FAILED
Failed to verify %1, you still have %2 verification opportunities
Unable to verify %1, please enter password.
AUTHENTICATION END
BIOMETRIC AUTHENTICATION END
ukui-biometric-auth/bioauth-bin/i18n_ts/es.ts 0000664 0001750 0001750 00000025713 15167732644 020063 0 ustar feng feng
BioAuthWidget
Form
Forma
More
更多
Retry
Reintentar
Too many unsuccessful attempts,please enter password.
验证失败达最大次数,请使用密码解锁
Bioauth authentication failed, you still have %1 verification opportunities
生物认证失败,您还有%1次尝试机会
Password
Contraseña
Current Device:
当前设备:
%1 too many unsuccessful attempts,please enter password.
%1 Demasiados intentos fallidos, ingrese la contraseña.
%1 authentication failure,there are still %2 remaining opportunities
%1 error de autenticación, todavía quedan %2 oportunidades
Please use wechat to scan the code
Utilice wechat para escanear el código
BioDevices
Unplugging of %1 device detected
Se ha detectado la desconexión del dispositivo %1
%1 device insertion detected
%1 inserción de dispositivo detectada
ukui-biometric-manager
ukui-gestor-biométrico
biometric
biométrico
FingerPrint
Huellas
FingerVein
FingerVein
Iris
Iris
Face
Cara
VoicePrint
Huella de voz
ukey
ukey
QRCode
QRCode
Wechat
微信
BioDevicesWidget
Form
Forma
Device types:
设备类型:
Back
返回
OK
确定
FingerPrint
指纹
LoginOptionsWidget
Login Options
Opciones de inicio de sesión
Password
Contraseña
Wechat
微信
Biometric
生物识别
QObject
FingerPrint
指纹
FingerVein
指静脉
Iris
虹膜
Face
人脸
VoicePrint
声纹
Enter the ukey password
Try it again
Use other Devices
Cancel
Choose the option
Invaild response "
authentication will be canceld
AUTHENTICATION CANCELED
=== BIOMETRIC DEVICES ===
Choose the device
Sevice Name
DISPLAY env
User
Display debug information
Device short name
UKEY AUTHENTICATION
BIOMETRIC AUTHENTICATION
Press Q or Esc to cancel
BIOMETRIC AUTHENTICATION IS CLOSED
AUTHENTICATION SUCCESS
AUTHENTICATION FAILED
Failed to verify %1, you still have %2 verification opportunities
Unable to verify %1, please enter password.
AUTHENTICATION END
BIOMETRIC AUTHENTICATION END
ukui-biometric-auth/bioauth-bin/i18n_ts/zh_HK.ts 0000664 0001750 0001750 00000014054 15167732644 020453 0 ustar feng feng
QObject
Enter the ukey password
輸入 ukey 密碼
Enter the ukey password
輸入 ukey 密碼
Try it again
再試一次
Use other Devices
使用其他設備
Cancel
取消
Choose the option
選擇選項
Invaild response "
Invaild 回應 ”
authentication will be canceld
身份驗證將被取消
AUTHENTICATION CANCELED
身份驗證已取消
=== BIOMETRIC DEVICES ===
=== 生物識別設備 ===
Choose the device
選擇設備
Sevice Name
服務名稱
DISPLAY env
顯示環境
User
使用者
Display debug information
顯示調試資訊
Device short name
設備簡稱
UKEY AUTHENTICATION
UKEY 身份驗證
BIOMETRIC AUTHENTICATION
生物識別身份驗證
Press Q or Esc to cancel
按 Q 或 Esc 鍵取消
BIOMETRIC AUTHENTICATION IS CLOSED
生物識別身份驗證已關閉
AUTHENTICATION SUCCESS
身份驗證成功
AUTHENTICATION FAILED
身份驗證失敗
Failed to verify %1, you still have %2 verification opportunities
驗證 %1 失敗,您仍有 %2 驗證機會
Unable to verify %1, please enter password.
無法驗證 %1,請輸入密碼。
AUTHENTICATION END
鑒權結束
BIOMETRIC AUTHENTICATION END
生物識別認證結束
ukui-biometric-auth/polkit-agent/ 0000775 0001750 0001750 00000000000 15167732644 016004 5 ustar feng feng ukui-biometric-auth/polkit-agent/src/ 0000775 0001750 0001750 00000000000 15167732644 016573 5 ustar feng feng ukui-biometric-auth/polkit-agent/src/mainwindow.cpp 0000664 0001750 0001750 00000166157 15167732644 021473 0 ustar feng feng /*
* Copyright (C) 2023 KylinSoftCo., 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 .
*
**/
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "../common/qt_matrix_compat.h"
#include "bioauthwidget.h"
#include
#include
#include
#include "generic.h"
#include "biotypes.h"
#include "modeButton.h"
#include
#define _(string) gettext(string)
extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed);
MainWindow::MainWindow(QWidget *parent)
: kdk::KDialog(parent)
, ui(new Ui::MainWindow)
, users(new Users(this))
, enableBioAuth(false)
, receiveBioPAM(false)
, authMode(UNDEFINED)
, useDoubleAuth(false)
, m_timer(nullptr)
, w_timer(nullptr)
, isLockingFlg(false)
, m_nCurLockMin(0)
, isbioSuccess(false)
{
ui->setupUi(this);
mainLayout()->addLayout(ui->verticalLayout_2);
pam_tally_init(); //
// 登录选项
m_labelTip = new KALabel();
m_labelTip->setText("");
m_labelTip->setFixedHeight(30);
m_labelTip->hide();
m_loginOptsWidget = new LoginOptionsWidget();
m_loginOptsWidget->hide();
ui->titleTipLayout->addWidget(m_labelTip);
ui->loginOptionsLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
ui->loginOptionsLayout->addWidget(m_loginOptsWidget);
ui->loadingUkeyWidget->adjustSize();
ui->loadingUkeyWidget->hide();
ui->widgetUkeyAuth->hide();
ui->loadingUkeyBtn->setAttribute(Qt::WA_TransparentForMouseEvents, true);
ui->ukeyPassword->setEchoMode(QLineEdit::Password);
ui->loadingUkeyLbl->setText(tr("Insert the ukey into the USB port"));
ui->loadingUkeyLbl->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
ui->ukeyTipLbl->setText(tr("Enter the ukey password"));
ui->ukeyPassword->setPlaceholderText(tr("Input Password"));
ui->btnCancel->setAutoDefault(false);
ui->btnCancel->setDefault(false);
maxFailedTimes = bioDevices.getFailedTimes();
isHiddenSwitchButton = bioDevices.GetHiddenSwitchButton();
closeButton()->setToolTip(tr("Close"));
// 连接登录选项信号响应槽
connect(m_loginOptsWidget, &LoginOptionsWidget::optionSelected, this, &MainWindow::onOptionSelected);
connect(m_loginOptsWidget, &LoginOptionsWidget::notifyOptionsChange, this, &MainWindow::onNotifyOptionsChanged);
connect(m_loginOptsWidget, &LoginOptionsWidget::authComplete, this, &MainWindow::onLoginOptionsAuthCompleted);
connect(m_loginOptsWidget, &LoginOptionsWidget::updateAuthMsg, this, &MainWindow::onUpdateBioAuthMsg);
connect(m_loginOptsWidget, &LoginOptionsWidget::updateWndSize, this, &MainWindow::onUpdateWndSize);
QFile qssFile(":/qss/src/main.qss");
qssFile.open(QIODevice::ReadOnly);
setStyleSheet(qssFile.readAll());
qssFile.close();
ui->lePassword->installEventFilter(this);
// 初始化UI状态
switchWidget(UNDEFINED);
editIcon();
ui->lblContent->adjustSize();
ui->lblContent->hide();
ui->lblMessage->setFixedSize(372, 30);
ui->widgetPasswdAuth->adjustSize();
ui->widgetUkeyAuth->adjustSize();
ui->cmbUsers->view()->setTextElideMode(Qt::ElideRight);
ui->cmbUsers->setFixedHeight(36);
ui->lePassword->setFixedHeight(36);
ui->btnBioAuth->hide();
ui->returnButton->hide();
ui->btnAuth->setProperty("isImportant", true);
ui->btnCancel->setProperty("useButtonPalette", true);
settings = new QGSettings("org.ukui.style", "", this);
fontSize = settings->get("system-font-size").toInt();
connect(settings, &QGSettings::changed, 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()
{
delete ui;
}
void MainWindow::onConfigurationChanged(QString key)
{
if (key == "systemFontSize") {
m_loginOptsWidget->updateUIStatus(false);
fontSize = settings->get("system-font-size").toInt();
}
if (key == "iconThemeName") {
setIcon(app_IconName);
}
if (key == "styleName") {
QPalette pe;
if (no_changes) {
pe.setColor(QPalette::Text, Qt::red);
m_labelTip->setPalette(pe);
} else {
QColor color = palette().color(QPalette::Text);
QPalette pal(this->palette());
pal.setColor(QPalette::Text, QColor(color));
m_labelTip->setPalette(pal);
}
}
}
void MainWindow::restart_bio_identify()
{
DeviceInfoPtr device = bioDevices.getDefaultDevice(getUid(userName));
if (device) {
m_loginOptsWidget->startAuth(device, getUid(userName));
setMessage(tr("Please enter your password or enroll your fingerprint "));
}
}
void MainWindow::closeEvent(QCloseEvent *event)
{
if (m_loginOptsWidget) {
m_loginOptsWidget->stopAuth();
}
m_failMap.clear();
emit canceled();
return kdk::KDialog::closeEvent(event);
}
void MainWindow::setUkeyTypeTip(QString text)
{
QString textTip = text;
if (!textTip.isEmpty()) {
QPalette pe;
pe.setColor(QPalette::Text, Qt::red);
ui->ukeyMessage->setPalette(pe);
ui->ukeyMessage->setText(textTip);
ui->ukeyMessage->setToolTip(text);
ui->ukeyMessage->show();
} else {
ui->ukeyMessage->hide();
}
}
void MainWindow::startLoadingUkey()
{
m_loadingPixmap = QIcon::fromTheme("ukui-loading-0-symbolic").pixmap(27, 27);
ui->loadingUkeyBtn->setIcon(m_loadingPixmap);
ui->loadingUkeyBtn->setIconSize(QSize(27, 27));
ui->loadingUkeyWidget->adjustSize();
ui->cmbUsers->hide();
ui->widgetUkeyAuth->hide();
ui->lePassword->hide();
ui->widgetPasswdAuth->hide();
isLoadingUkey = true;
ui->loadingUkeyWidget->show();
if (!m_loadingTimer) {
m_loadingTimer = new QTimer(this);
m_loadingTimer->setInterval(150);
connect(m_loadingTimer, &QTimer::timeout, this, &MainWindow::updateLoadingPixmap);
}
m_loadingTimer->start();
}
void MainWindow::stopLoadingUkey()
{
isLoadingUkey = false;
if (m_loadingTimer) {
m_loadingTimer->stop();
}
ui->loadingUkeyWidget->hide();
// ui->cmbUsers->show();
// ui->widgetUkeyAuth->show();
}
void MainWindow::updateLoadingPixmap()
{
QMatrix matrix;
matrix.rotate(90.0);
m_loadingPixmap = QtPixmapCompat::transformedPixmap(m_loadingPixmap, matrix, Qt::FastTransformation);
ui->loadingUkeyBtn->setIcon(QIcon(m_loadingPixmap));
}
void MainWindow::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event);
QStyleOption *option = new QStyleOption();
QPainter p(this);
p.setRenderHint(QPainter::Antialiasing);
QPainterPath rectPath;
rectPath.addRoundedRect(this->rect().adjusted(0, 0, 0, 0), 0, 0);
// 画一个黑底
QPixmap pixmap(this->rect().size());
pixmap.fill(Qt::transparent);
QPainter pixmapPainter(&pixmap);
pixmapPainter.setRenderHint(QPainter::Antialiasing);
pixmapPainter.setPen(Qt::transparent);
pixmapPainter.setBrush(QColor(0, 0, 0, 100));
pixmapPainter.drawPath(rectPath);
pixmapPainter.end();
// 模糊这个黑底
QImage img = pixmap.toImage();
qt_blurImage(img, 10, false, false);
// 挖掉中心
pixmap = QPixmap::fromImage(img);
QPainter pixmapPainter2(&pixmap);
pixmapPainter2.setRenderHint(QPainter::Antialiasing);
pixmapPainter2.setCompositionMode(QPainter::CompositionMode_Clear);
pixmapPainter2.setPen(Qt::transparent);
pixmapPainter2.setBrush(Qt::transparent);
pixmapPainter2.drawPath(rectPath);
// 绘制阴影
p.drawPixmap(this->rect(), pixmap, pixmap.rect());
// 绘制一个背景
p.save();
p.fillPath(rectPath, option->palette.color(QPalette::Base));
p.restore();
}
bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
if (obj == ui->lePassword) {
if (event->type() == QEvent::KeyPress) { // 禁止复制粘贴功能。
QKeyEvent *keyEvent = static_cast(event);
if (keyEvent->matches(QKeySequence::Copy) || keyEvent->matches(QKeySequence::Cut)
|| keyEvent->matches(QKeySequence::Paste)) {
event->ignore();
return true;
}
}
if (event->type() == QEvent::MouseButtonRelease) { // 禁用鼠标中键
QMouseEvent *mouseevent = static_cast(event);
#if QT_VERSION_MAJOR == 6
if (mouseevent->button() == Qt::MiddleButton) {
#else
if (mouseevent->button() == Qt::MidButton) {
#endif
event->ignore();
return true;
}
}
}
return kdk::KDialog::eventFilter(obj, event);
}
void MainWindow::keyPressEvent(QKeyEvent *event)
{
switch (event->key()) {
case Qt::Key_Escape: {
break;
}
default: {
kdk::KDialog::keyPressEvent(event);
break;
}
}
}
/*** main ***/
void MainWindow::on_cmbUsers_currentTextChanged(const QString &userName)
{
qDebug() << "user changed to " << userName;
m_loginOptsWidget->stopAuth();
if (m_bioTimer && m_bioTimer->isActive())
m_bioTimer->stop();
authMode = UNDEFINED;
QList accountUsers = users->getUsers();
this->userName = userName;
for (UserItem user : accountUsers) {
if (user.realName == userName) {
this->userName = user.name;
}
}
m_deviceInfo = DeviceInfoPtr();
ui->lblMessage->clear();
ui->lblMessage->setToolTip("");
setMessage("");
isLockingFlg = false;
emit userChanged(this->userName);
}
int MainWindow::enable_biometric_authentication()
{
char conf_file[] = GET_STR(CONFIG_FILE);
FILE *file;
char line[1024], is_enable[16];
int i;
if ((file = fopen(conf_file, "r")) == NULL) {
return 0;
}
while (fgets(line, sizeof(line), file)) {
i = sscanf(line, "EnableAuth=%s\n", is_enable);
if (i > 0) {
break;
}
}
fclose(file);
if (!strcmp(is_enable, "true"))
return 1;
return 0;
}
void MainWindow::on_btnDetails_clicked()
{ /*
if(ui->widgetDetails->isHidden()) {
ui->widgetDetails->show();
ui->btnDetails->setIcon(QIcon(":/image/assets/arrow_down.svg"));
// resize(width(), height() + ui->widgetDetails->height());
}
else {
ui->widgetDetails->hide();
ui->btnDetails->setIcon(QIcon(":/image/assets/arrow_right.svg"));
// resize(width(), height() - ui->widgetDetails->height());
}
adjustSize();*/
}
void MainWindow::on_btnCancel_clicked()
{
close();
}
void MainWindow::on_btnAuth_clicked()
{
if (doNotNeedAuth) {
emit yesPrompted();
return;
}
if (ui->widgetUkeyAuth->isVisible()) {
on_ukeyPassword_returnPressed();
} else {
on_lePassword_returnPressed();
}
}
void MainWindow::onShowYesPrompt()
{
doNotNeedAuth = true;
ui->widgetPasswdAuth->hide();
ui->cmbUsers->hide();
ui->btnBioAuth->hide();
ui->returnButton->hide();
ui->btnAuth->show();
}
void MainWindow::onLockStatus()
{
// m_loginOptsWidget->stopAuth();
m_loginOptsWidget->lockStatusChanged(true);
}
void MainWindow::onUnlockStatus()
{
// m_loginOptsWidget->readDevicesInfo();
m_loginOptsWidget->lockStatusChanged(false);
startBioAuth();
}
/*** pagePassword ***/
void MainWindow::editIcon()
{
m_modeButton = new ModeButton(ui->lePassword);
m_modeButton->setFocusPolicy(Qt::NoFocus);
connect(m_modeButton, &QPushButton::clicked, this, [=]() {
if (ui->lePassword->echoMode() == QLineEdit::Password) {
ui->lePassword->setEchoMode(QLineEdit::Normal);
} else {
ui->lePassword->setEchoMode(QLineEdit::Password);
}
});
QHBoxLayout *layout = new QHBoxLayout(ui->lePassword);
layout->addStretch();
layout->addWidget(m_modeButton);
layout->setContentsMargins(0, 0, 8, 0);
ui->lePassword->setTextMargins(1, 1, 4 + m_modeButton->width(), 1);
}
void MainWindow::on_ukeyPassword_returnPressed()
{
if (m_loginOptsWidget && m_deviceInfo) {
m_loginOptsWidget->SetExtraInfo(ui->ukeyPassword->text(), "pincode");
m_loginOptsWidget->startAuth(m_deviceInfo, getUid(userName));
}
}
void MainWindow::on_lePassword_returnPressed()
{
emit accept(ui->lePassword->text());
ui->btnAuth->hide();
ui->btnLoading->show();
setMessage("");
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);
// setMessage(tr("in authentication, please wait..."));
hasSendPassword = true;
}
void MainWindow::on_btnBioAuth_clicked()
{
emit switchToBiometric();
authMode = BIOMETRIC;
}
void MainWindow::on_returnButton_clicked()
{
m_loginOptsWidget->stopAuth();
accept(BIOMETRIC_IGNORE);
}
/*** end of control's slot ***/
/*** public member ***/
void MainWindow::setIcon(const QString &iconName)
{
// QIcon::setThemeName("ukui-icon-theme");
app_IconName = iconName;
if (!QIcon::hasThemeIcon("ukui-polkit")) {
QDir iconsDir("/usr/share/icons");
auto themesList = iconsDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
qDebug() << themesList;
for (auto theme : themesList) {
QIcon::setThemeName(theme);
if (QIcon::hasThemeIcon("ukui-polkit")) {
qDebug() << theme << "has ukui-polkit icon";
break;
}
}
}
QPixmap icon = QIcon::fromTheme("ukui-polkit").pixmap(64, 64);
QPixmap actionIcon = QIcon::fromTheme(app_IconName).pixmap(32, 32);
QPainter painter;
painter.begin(&icon);
QRect rect(32, 32, 32, 32);
painter.drawPixmap(rect, actionIcon);
painter.end();
setWindowIcon(icon);
// ui->lblIcon->setPixmap(icon);
}
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->adjustSize();
ui->lblContent->setText(tr("A program is attempting to perform an action that requires privileges."
"It requires authorization to perform the action."));
ui->lblContent->adjustSize();
}
void MainWindow::setUsers(const QStringList &usersList)
{
if (usersList.isEmpty())
return;
if (usersList.size() == 1) {
UserItem user = users->getUserByName(usersList.at(0));
if (user.realName != "") {
userName = user.realName;
} else {
userName = usersList.at(0);
}
}
QList accountUsers = users->getUsers();
for (QString identifyUser : usersList) {
bool isFoundAccount = false;
for (UserItem user : accountUsers) {
if (identifyUser == user.name) {
if (user.realName != "")
ui->cmbUsers->addItem(user.realName);
else
ui->cmbUsers->addItem(user.name);
isFoundAccount = true;
break;
}
}
if (!isFoundAccount) {
ui->cmbUsers->addItem(identifyUser);
}
}
ui->cmbUsers->show();
// ui->cmbUsers->adjustSize();
}
/*
void MainWindow::setDetails(const QString &subPid, const QString &callerPid, const QString &actionId,
const QString &actionDesc, const QString vendorName,
const QString vendorUrl)
{
ui->lblSubjectPid->setText(subPid);
ui->lblCallerPid->setText(callerPid);
ui->lblActionId->setText(actionId);
ui->lblActionDesc->setText(actionDesc);
QString vendor = QString("%2").arg(vendorUrl).arg(vendorName);
ui->lblVendor->setText(vendor);
}
*/
void MainWindow::setPrompt(const QString &text, bool echo)
{
QString prompt = text;
if (text == "Input Password") {
prompt = tr("Input Password");
} else if (text == "Password: " || text == "Password:") {
prompt = tr("Password: ");
} else if (text == "_Password: ") {
prompt = tr("_Password: ");
} else if (text == "_Password:") {
prompt = tr("_Password:");
}
if (!m_timer) {
m_timer = new QTimer(this);
m_timer->setInterval(200);
connect(m_timer, &QTimer::timeout, this, &MainWindow::unlock_countdown);
}
// qDebug() << "6666";
m_timer->start();
unlock_countdown();
ui->lePassword->clear();
ui->lePassword->setPlaceholderText(prompt);
// switchWidget(PASSWORD);
}
/*
转换pam英文提示,目前转换的就3个翻译
Authenticated failed, account locked!
Authenticated failed, 1 login attemps left
Account locked, 4 minutes left
*/
QString MainWindow::check_is_pam_message(QString text)
{
if (text.isEmpty()) {
return text;
}
setlocale(LC_ALL, "");
bindtextdomain("Linux-PAM", "/usr/share/locale");
bind_textdomain_codeset("Linux-PAM", "UTF-8");
textdomain("Linux-PAM");
char *str;
QString strTrans = "";
QByteArray ba = text.toLocal8Bit(); // must
str = ba.data();
char l_str[1024];
int a, b;
// 兼容旧版本翻译,以及适配新版本翻译
// 因为不知道什么原因,pam发过来的始终为英文,因此这里主动加载pam的翻译文件,使用gettext获取翻译
if (text.contains("attemps", Qt::CaseSensitive) && sscanf(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))
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))
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)) {
// 这里的消息是多个字符串拼接起来的,无法在翻译文件中找到对应的句子,只能自己翻译
strTrans = tr("Account locked,") + QString("%1 ").arg(a) + tr("days left");
return strTrans;
} else if (text.contains("hours", Qt::CaseSensitive) && sscanf(str, "Account locked, %d hours left", &a)) {
strTrans = tr("Account locked,") + QString("%1 ").arg(a) + tr("hours left");
return strTrans;
} else if (text.contains("minutes", Qt::CaseSensitive) && sscanf(str, "Account locked, %d minutes left", &a)) {
strTrans = tr("Account locked,") + QString("%1 ").arg(a) + tr("minutes left");
return strTrans;
} else if (text.contains("seconds", Qt::CaseSensitive) && sscanf(str, "Account locked, %d seconds left", &a)) {
strTrans = tr("Account locked,") + QString("%1 ").arg(a) + tr("seconds left");
return strTrans;
} else if (
text.contains("Warning: ", Qt::CaseSensitive)
&& sscanf(str, "Warning: your password will expire in %d day", &a)) {
snprintf(l_str, 1024, _("Warning: your password will expire in %d day"), a);
} else if (
text.contains("Warning: ", Qt::CaseSensitive)
&& sscanf(str, "Warning: your password will expire in %d days", &a)) {
snprintf(l_str, 1024, _("Warning: your password will expire in %d days"), a);
} else {
return _(str);
}
qDebug() << "l_str = " << l_str;
return QString(l_str);
}
void MainWindow::setMessage(const QString &text, situation situat)
{
if (situat == ERROR) {
QPalette pe;
pe.setColor(QPalette::Text, Qt::red);
ui->lblMessage->setPalette(pe);
// ui->lePassword->setStyleSheet("QLineEdit{background-color: palette(Button);"
// "border-radius: 6px;border: 1px solid #F3222D;}");
} else if (situat == TRUE) {
QColor color = palette().color(QPalette::Text);
QPalette pal(this->palette());
pal.setColor(QPalette::Text, QColor(color));
ui->lblMessage->setPalette(pal);
}
// qDebug()<<"receive:text = "<setInterval(800);
connect(m_timer, &QTimer::timeout, this, &MainWindow::unlock_countdown);
}
m_timer->start();
} else if (text.indexOf("No password received, please input password") != -1) {
ui->lblMessage->setText(tr("Password cannot be empty"));
ui->lblMessage->setToolTip(tr("Password cannot be empty"));
} else {
ui->lblMessage->setText(text);
ui->lblMessage->setToolTip(text);
}
// ui->lblMessage->adjustSize();
// ui->widgetPasswdAuth->adjustSize();
// ui->lblMessage->setText(text);
}
void MainWindow::setAuthResult(bool result, const QString &text)
{
QString message = text;
if (!result && text.isEmpty()) {
message = tr("Authentication failed, please try again.");
}
if (authMode == PASSWORD) {
switchWidget(PASSWORD);
setMessage(message, ERROR);
} else if (authMode == BIOMETRIC)
setMessage(message, ERROR);
}
void MainWindow::clearEdit()
{
ui->lePassword->setText("");
ui->lePassword->setDisabled(true);
ui->lePassword->setReadOnly(true);
ui->ukeyPassword->setText("");
ui->btnAuth->setDisabled(true);
}
void MainWindow::switchAuthMode(Mode mode)
{
if (isbioSuccess) {
accept(BIOMETRIC_SUCCESS);
return;
}
int uid = getUid(userName);
m_loginOptsWidget->setUser(uid);
int count = m_loginOptsWidget->getLoginOptCount();
enableBioAuth = count > 0;
if (count < 1) {
setLoginTypeTip(tr("Input your password to authentication"));
m_loginOptsWidget->hide();
} else {
m_loginOptsWidget->show();
m_loginOptsWidget->setEnabled(true);
}
if (m_loginOptsWidget->getHasUkeyOptions()) {
setLoginTypeTip(tr("Input your password to authentication"));
m_loginOptsWidget->show();
}
switch (mode) {
case PASSWORD: {
qDebug() << "switch to password";
authMode = mode;
if (!enableBioAuth || !receiveBioPAM || useDoubleAuth) {
ui->btnBioAuth->hide();
} else {
ui->btnBioAuth->show();
}
if (isHiddenSwitchButton) {
ui->btnBioAuth->hide();
}
if (hasSendPassword && authMethod == "otp") {
if (checkIsAdmin(userName)) {
setLoginTypeTip(
tr("Enter the two-factor authentication (2FA) OTP token for the administrator \"%1\"")
.arg(userName));
} else {
setLoginTypeTip(
tr("Enter the two-factor authentication (2FA) OTP dynamic token for the user \"%1\"")
.arg(userName));
}
ui->cmbUsers->hide();
} else if (hasSendPassword && authMethod == "ukey") {
if (checkIsAdmin(userName)) {
setLoginTypeTip(
tr("Enter the two-factor authentication (2FA) security key for the administrator \"%1\"")
.arg(userName));
} else {
setLoginTypeTip(
tr("Enter the two-factor authentication (2FA) security key for the user \"%1\"").arg(userName));
}
ui->cmbUsers->hide();
}
} break;
case BIOMETRIC: {
if (authMode == PASSWORD) {
emit accept(BIOMETRIC_IGNORE);
isFirstAuth = false;
return;
}
authMode = mode;
qDebug() << "switch to biometric";
unlock_countdown();
if (m_deviceInfo) {
if (!m_loginOptsWidget->findDeviceById(m_deviceInfo->device_id)
|| m_loginOptsWidget->isDeviceDisable(m_deviceInfo->device_id)) {
m_deviceInfo = DeviceInfoPtr();
}
}
if (!enableBioAuth) {
qDebug() << "It doesn't meet the condition for enabling biometric authentication, switch to password.";
emit accept(BIOMETRIC_IGNORE);
isFirstAuth = false;
return;
} else if (authMode == BIOMETRIC) {
QString strDeviceName;
if (isLoadingUkey) {
strDeviceName = m_loginOptsWidget->GetDefaultDevice(uid, UniT_General_Ukey);
} else {
strDeviceName = m_loginOptsWidget->GetDefaultDevice(uid);
}
// 如果默认设备为空的话,第一次不启动生物识别认证
if (strDeviceName.isEmpty() && !m_deviceInfo) {
qDebug() << "No default device";
emit accept(BIOMETRIC_IGNORE);
isFirstAuth = false;
return;
}
// 第一次,获取默认设备的设备信息,之后使用的则是从设备选择窗口传出的设备信息
if (!m_deviceInfo) {
m_deviceInfo = m_loginOptsWidget->findDeviceByName(strDeviceName);
}
if (!m_deviceInfo) {
emit accept(BIOMETRIC_IGNORE);
isFirstAuth = false;
return;
}
if (m_failMap.contains(uid) && m_failMap[uid].contains(m_deviceInfo->device_id)
&& m_failMap[uid][m_deviceInfo->device_id] >= maxFailedTimes) {
emit accept(BIOMETRIC_IGNORE);
isFirstAuth = false;
m_deviceInfo = DeviceInfoPtr();
return;
}
if (m_deviceInfo && m_loginOptsWidget->isDeviceDisable(m_deviceInfo->device_id)) {
emit accept(BIOMETRIC_IGNORE);
isFirstAuth = false;
m_deviceInfo = DeviceInfoPtr();
return;
}
if (m_deviceInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY) {
if (isFirstAuth) {
isFirstAuth = false;
m_deviceInfo = nullptr;
emit accept(BIOMETRIC_IGNORE);
return;
}
switchLoginOptType(LOGINOPT_TYPE_GENERAL_UKEY);
stopLoadingUkey();
startBioAuth();
m_loginOptsWidget->setCurrentDevice(m_deviceInfo);
m_loginOptsWidget->updateUIStatus(false);
return;
}
isFirstAuth = false;
switchLoginOptType(m_loginOptsWidget->convertDeviceType(m_deviceInfo->biotype));
startBioAuth();
emit accept(BIOMETRIC_IGNORE);
return;
}
} break;
default:
break;
}
switchWidget(mode);
}
/*** end of public memeber ***/
/*** private member ***/
uid_t MainWindow::getUid(const QString &userName)
{
struct passwd *pwd = getpwnam(userName.toStdString().c_str());
if (pwd == NULL) {
qWarning() << "getpwnam error: " << strerror(errno);
return -1;
}
return pwd->pw_uid;
}
void MainWindow::setDoubleAuth(bool val)
{
useDoubleAuth = val;
}
void MainWindow::stopDoubleAuth()
{
// if(useDoubleAuth && widgetBioAuth)
// widgetBioAuth->stopAuth();
}
void MainWindow::switchWidget(Mode mode)
{
ui->widgetPasswdAuth->hide();
ui->btnAuth->hide();
ui->btnLoading->hide();
ui->btnAuth->setText(tr("Authenticate"));
ui->btnBioAuth->setText(tr("Biometric"));
ui->btnCancel->setText(tr("Cancel"));
ui->returnButton->setText(tr("Use password"));
ui->btnLoading->setDisabled(true);
if (is_Mavis) {
ui->cmbUsers->setFixedHeight(48);
ui->lePassword->setFixedHeight(48);
ui->ukeyPassword->setFixedHeight(48);
ui->btnAuth->setFixedHeight(48);
ui->btnCancel->setFixedHeight(48);
} else {
ui->cmbUsers->setFixedHeight(36);
ui->lePassword->setFixedHeight(36);
ui->ukeyPassword->setFixedHeight(36);
ui->btnAuth->setFixedHeight(36);
ui->btnBioAuth->setFixedHeight(36);
ui->btnCancel->setFixedHeight(36);
ui->returnButton->setFixedHeight(36);
}
switch (mode) {
case PASSWORD: {
setFixedWidth(420);
if (m_deviceInfo && m_loginOptsWidget->findDeviceById(m_deviceInfo->device_id)) {
switchLoginOptType(m_loginOptsWidget->convertDeviceType(m_deviceInfo->biotype));
} else {
switchLoginOptType(LOGINOPT_TYPE_PASSWORD);
m_loginOptsWidget->setSelectedPassword();
}
// 标题+间隔+内容头+间隔+类型提示+间隔+用户列表+间隔+
// (密码输入框+间隔+验证提示+间隔+授权按钮+边距)/ --仅密码方式
// (密码输入框+间隔+验证提示+间隔+登录选项+间隔+授权按钮+边距)/ --密码+生物识别 选择密码
// (登录选项+间隔+授权按钮+边距)/ --密码+生物识别 选择生物识别
// (ukey加载页+间隔+登录选项+间隔+授权按钮+边距)/(ukey认证页+间隔+登录选项+间隔+授权按钮+边距)
// --选择Ukey
int height = 40 + 8 + ui->lblHeader->height() + 8 + m_labelTip->height() + 8;
switch (m_uCurLoginOptType) {
case LOGINOPT_TYPE_PASSWORD: {
height += ui->cmbUsers->height() + 8 + ui->lePassword->height() + 8 + ui->lblMessage->height() + 8;
} break;
case LOGINOPT_TYPE_FACE:
case LOGINOPT_TYPE_FINGERPRINT:
case LOGINOPT_TYPE_FINGERVEIN:
case LOGINOPT_TYPE_IRIS:
case LOGINOPT_TYPE_VOICEPRINT:
case LOGINOPT_TYPE_QRCODE: {
height += ui->cmbUsers->height() + 8;
} break;
case LOGINOPT_TYPE_GENERAL_UKEY:
case LOGINOPT_TYPE_ADVANCED_UKEY: {
if (!ui->widgetUkeyAuth->isHidden()) {
height += ui->widgetUkeyAuth->height() + 8;
} else if (!ui->loadingUkeyWidget->isHidden()) {
height += ui->loadingUkeyWidget->height() + 8;
}
} break;
default:
break;
}
if (!m_loginOptsWidget->isHidden()) {
height += m_loginOptsWidget->height() + 8;
}
height += ui->btnAuth->height() + 24;
setFixedSize(width(), height);
qInfo() << "MainWindow geometry:" << geometry() << height;
// m_loginOptsWidget->updateUIStatus();
ui->btnBioAuth->setStyleSheet("QPushButton{font-size:14px;}QPushButton:hover{border:none;color:#3E6CE5;}"
"QPushButton:pressed{border:none;}");
ui->btnBioAuth->setFlat(true);
ui->btnBioAuth->setText(tr("Biometric"));
ui->btnBioAuth->setAttribute(Qt::WA_UnderMouse, false);
ui->btnBioAuth->adjustSize();
if (m_uCurLoginOptType == LOGINOPT_TYPE_PASSWORD) {
ui->widgetPasswdAuth->show();
ui->lePassword->setFocus();
// 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->btnAuth->show();
ui->btnLoading->hide();
if (w_timer && w_timer->isActive()) {
w_timer->stop();
}
ui->btnCancel->show();
// ui->lblContent->show();
ui->returnButton->hide();
ui->lblContent->hide();
} break;
case BIOMETRIC:
setFixedWidth(420);
ui->btnCancel->hide();
ui->lblContent->hide();
ui->btnBioAuth->hide();
break;
default:
break;
}
// adjustSize();
}
void MainWindow::unlock_countdown()
{
int failed_count = 0;
int time_left = 0;
int deny = 0;
int fail_time = 0;
int unlock_time = 0;
pam_tally_unlock_time_left(getUid(userName), &failed_count, &time_left, &deny, &fail_time, &unlock_time);
// qDebug() << "failed_count:" << failed_count << "time_left:" <= 60) // 请多少分钟后重试
{
int nMinuteleft = time_left / 60;
if (isLockingFlg == false) {
m_nCurLockMin = unlock_time / 60; // 获取当前需要锁定的分钟数
}
// 如果当前设置的不是1min钟锁定,那么1min显示成2min,由2min直接跳到59s ||
// 剩余分钟数小于当前设置的锁定时间,并且大于1min,自增+1
if ((nMinuteleft == 1 && m_nCurLockMin != 1) || (nMinuteleft > 1 && nMinuteleft < m_nCurLockMin)) {
nMinuteleft = nMinuteleft + 1;
}
setMessage(tr("Please try again in %1 minutes.").arg(nMinuteleft), ERROR);
// ui->lblMessage->setToolTip(tr("Please try again in %1 minutes.").arg(nMinute));
ui->lePassword->setText("");
ui->lePassword->setDisabled(true);
ui->lePassword->setReadOnly(true);
ui->btnAuth->setDisabled(true);
isLockingFlg = true;
setBiometricAuthDisabledStatus(isLockingFlg);
return;
} else if (time_left > 0 && time_left < 60) // 请多少秒后重试
{
char ch[100] = { 0 };
setMessage(tr("Please try again in %1 seconds.").arg(time_left % 60), ERROR);
// ui->lblMessage->setToolTip(tr("Please try again in %1 seconds.").arg(time_left%60));
ui->lePassword->setText("");
ui->lePassword->setDisabled(true);
ui->lePassword->setReadOnly(true);
ui->btnAuth->setDisabled(true);
isLockingFlg = true;
setBiometricAuthDisabledStatus(isLockingFlg);
return;
} else if (failed_count == 0xFFFF) // 账号被永久锁定
{
ui->lblMessage->setText(tr("Account locked permanently."));
ui->lblMessage->setToolTip(tr("Account locked permanently."));
ui->lePassword->setText("");
ui->lePassword->setDisabled(true);
ui->lePassword->setReadOnly(true);
ui->btnAuth->setDisabled(true);
isLockingFlg = true;
setBiometricAuthDisabledStatus(isLockingFlg);
return;
} else {
if (ui->lePassword) {
ui->lePassword->setDisabled(false);
ui->lePassword->setReadOnly(false);
ui->lePassword->setFocus();
}
if (ui->btnAuth) {
ui->btnAuth->setDisabled(false);
}
if (isLockingFlg) {
// setMessage(tr("Authentication failed, please try again."),ERROR);
setMessage("");
isLockingFlg = false;
setBiometricAuthDisabledStatus(isLockingFlg);
}
if (m_timer) {
m_timer->stop();
}
}
return;
}
void MainWindow::root_unlock_countdown()
{
int failed_count = 0;
int time_left = 0;
int deny = 0;
int fail_time = 0;
int unlock_time = 0;
pam_tally_root_unlock_time_left(&failed_count, &time_left, &deny, &fail_time, &unlock_time);
// qDebug() << "failed_count:" << failed_count << "time_left:" <= 60) // 请多少分钟后重试
{
int nMinuteleft = time_left / 60;
if (isLockingFlg == false) {
m_nCurLockMin = unlock_time / 60; // 获取当前需要锁定的分钟数
}
// 如果当前设置的不是1min钟锁定,那么1min显示成2min,由2min直接跳到59s ||
// 剩余分钟数小于当前设置的锁定时间,并且大于1min,自增+1
if ((nMinuteleft == 1 && m_nCurLockMin != 1) || (nMinuteleft > 1 && nMinuteleft < m_nCurLockMin)) {
nMinuteleft = nMinuteleft + 1;
}
ui->lblMessage->setText(tr("Please try again in %1 minutes.").arg(nMinuteleft));
ui->lblMessage->setToolTip(tr("Please try again in %1 minutes.").arg(nMinuteleft));
ui->lePassword->setText("");
ui->lePassword->setDisabled(true);
ui->lePassword->setReadOnly(true);
ui->btnAuth->setDisabled(true);
isLockingFlg = true;
setBiometricAuthDisabledStatus(isLockingFlg);
return;
} else if (time_left > 0 && time_left < 60) // 请多少秒后重试
{
char ch[100] = { 0 };
ui->lblMessage->setText(tr("Please try again in %1 seconds.").arg(time_left % 60));
ui->lblMessage->setToolTip(tr("Please try again in %1 seconds.").arg(time_left % 60));
ui->lePassword->setText("");
ui->lePassword->setDisabled(true);
ui->lePassword->setReadOnly(true);
ui->btnAuth->setDisabled(true);
isLockingFlg = true;
setBiometricAuthDisabledStatus(isLockingFlg);
return;
} else if (failed_count == 0xFFFF) // 账号被永久锁定
{
ui->lblMessage->setText(tr("Account locked permanently."));
ui->lblMessage->setToolTip(tr("Account locked permanently."));
ui->lePassword->setText("");
ui->lePassword->setDisabled(true);
ui->lePassword->setReadOnly(false);
ui->btnAuth->setDisabled(true);
isLockingFlg = true;
setBiometricAuthDisabledStatus(isLockingFlg);
return;
} else {
if (ui->lePassword) {
ui->lePassword->setDisabled(false);
ui->lePassword->setReadOnly(false);
ui->lePassword->setFocus();
}
if (ui->btnAuth) {
ui->btnAuth->setDisabled(false);
}
if (isLockingFlg) {
// setMessage(tr("Authentication failed, please try again."),ERROR);
setMessage("");
isLockingFlg = false;
setBiometricAuthDisabledStatus(isLockingFlg);
}
m_timer->stop();
}
return;
}
void MainWindow::setBiometricAuthDisabledStatus(bool locked)
{
if (locked) {
if (m_loginOptsWidget) {
m_loginOptsWidget->stopAuth();
m_loginOptsWidget->setAllDeviceDisable(true);
if (m_bioTimer && m_bioTimer->isActive())
m_bioTimer->stop();
}
if (m_deviceInfo && m_deviceInfo->biotype == BIOTYPE_FACE) {
QImage imgFailed;
m_loginOptsWidget->setFaceImg(imgFailed, 1);
} else if (m_deviceInfo && m_deviceInfo->biotype == REMOTE_QRCODE_TYPE) {
QImage nullImage;
m_loginOptsWidget->setQRCode(nullImage);
}
} else {
if (m_loginOptsWidget) {
if (m_deviceInfo) {
m_loginOptsWidget->startAuth(m_deviceInfo, getUid(userName));
}
m_loginOptsWidget->setAllDeviceDisable(false);
}
}
}
void MainWindow::onRespondUkey(const QString &text)
{
if (m_loginOptsWidget) {
m_loginOptsWidget->SetExtraInfo(text, "pincode");
}
}
void MainWindow::switchLoginOptType(unsigned uLoginOptType)
{
switch (uLoginOptType) {
case LOGINOPT_TYPE_PASSWORD: {
// m_loginOptsWidget->hide();
ui->lePassword->show();
ui->cmbUsers->show();
ui->widgetPasswdAuth->show();
ui->widgetUkeyAuth->hide();
ui->ukeyPassword->clearFocus();
ui->loadingUkeyWidget->hide();
setFocusProxy(ui->lePassword);
ui->cmbUsers->show();
if (hasSendPassword && (authMethod == "ukey" || authMethod == "otp")) {
ui->cmbUsers->hide();
}
m_loginOptsWidget->stopBioWaiting();
} break;
case LOGINOPT_TYPE_FACE:
case LOGINOPT_TYPE_FINGERPRINT:
case LOGINOPT_TYPE_IRIS:
case LOGINOPT_TYPE_VOICEPRINT:
case LOGINOPT_TYPE_FINGERVEIN:
case LOGINOPT_TYPE_QRCODE: {
switch (uLoginOptType) {
case LOGINOPT_TYPE_FINGERPRINT:
case LOGINOPT_TYPE_IRIS:
case LOGINOPT_TYPE_VOICEPRINT:
case LOGINOPT_TYPE_FINGERVEIN: {
m_loginOptsWidget->startBioWaiting(uLoginOptType);
} break;
default:
m_loginOptsWidget->stopBioWaiting();
break;
}
// 延迟检查错误状态
m_isNetworkErr = false;
QTimer::singleShot(500, this, [&, this]() {
if (!this->m_isNetworkErr) {
m_loginOptsWidget->setQRCodeMsg("");
}
});
ui->lePassword->show();
ui->widgetUkeyAuth->hide();
ui->loadingUkeyWidget->hide();
ui->ukeyPassword->clearFocus();
setFocusProxy(ui->lePassword);
ui->cmbUsers->show();
ui->widgetPasswdAuth->hide();
} break;
case LOGINOPT_TYPE_GENERAL_UKEY: {
ui->lePassword->hide();
ui->cmbUsers->hide();
if (m_deviceInfo) {
stopLoadingUkey();
ui->widgetUkeyAuth->show();
} else {
startLoadingUkey();
}
setFocusProxy(ui->ukeyPassword);
ui->ukeyPassword->setFocusPolicy(Qt::StrongFocus);
ui->ukeyPassword->setFocus();
ui->widgetPasswdAuth->hide();
m_loginOptsWidget->stopBioWaiting();
} break;
default:
return;
}
qDebug() << "CurOptType:" << uLoginOptType;
if (m_deviceInfo && m_failMap.contains(getUid(userName))
&& m_failMap[getUid(userName)].contains(m_deviceInfo->device_id)
&& m_failMap[getUid(userName)][m_deviceInfo->device_id] >= maxFailedTimes) {
if (m_deviceInfo->biotype == BIOTYPE_FACE) {
QImage imgFailed;
m_loginOptsWidget->setFaceImg(imgFailed, 1);
}
no_changes = true;
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)));
} else if (m_deviceInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY) {
setUkeyTypeTip(tr("Failed to verify %1, please enter password to unlock")
.arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype)));
} else {
setLoginTypeTip(tr("Unable to verify %1, please enter password to unlock")
.arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype)));
m_loginOptsWidget->stopBioWaiting(true);
}
m_loginOptsWidget->setDeviceDisable(m_deviceInfo->device_id, true);
} else {
no_changes = false;
if (uLoginOptType != m_uCurLoginOptType || (m_deviceInfo && m_deviceInfo->device_id != m_nLastDeviceId)) {
switch (uLoginOptType) {
case LOGINOPT_TYPE_PASSWORD: {
setLoginTypeTip(tr("Input your password to authentication"));
} break;
case LOGINOPT_TYPE_FACE: {
setLoginTypeTip(tr("Facial recognition to authorization"));
} break;
case LOGINOPT_TYPE_FINGERPRINT: {
setLoginTypeTip(tr("Fingerprint recognition to authorization"));
} break;
case LOGINOPT_TYPE_VOICEPRINT: {
setLoginTypeTip(tr("Voiceprint recognition to authorization"));
} break;
case LOGINOPT_TYPE_FINGERVEIN: {
setLoginTypeTip(tr("Finger veins recognition to authorization"));
} break;
case LOGINOPT_TYPE_IRIS: {
setLoginTypeTip(tr("Iris recognition to authorization"));
} break;
case LOGINOPT_TYPE_QRCODE: {
QString strDrivName = tr("wechat");
if (m_deviceInfo && m_deviceInfo->device_shortname != "wechat_driver") {
strDrivName = m_deviceInfo->device_shortname;
}
setLoginTypeTip(tr("Use the bound %1 scanning code to authorization").arg(strDrivName));
} break;
case LOGINOPT_TYPE_GENERAL_UKEY: {
setLoginTypeTip("");
} break;
default:
return;
}
}
}
if (m_deviceInfo) {
m_nLastDeviceId = m_deviceInfo->device_id;
} else {
m_nLastDeviceId = -1;
}
m_uCurLoginOptType = uLoginOptType;
m_loginOptsWidget->updateUIStatus(true, m_uCurLoginOptType);
}
void MainWindow::setLoginTypeTip(QString strLoginTypeTip)
{
m_strLoginTypeTip = strLoginTypeTip;
if (m_strLoginTypeTip.isEmpty()) {
m_labelTip->hide();
} else {
QPalette pe;
if (no_changes) {
pe.setColor(QPalette::Text, Qt::red);
m_labelTip->setPalette(pe);
} else {
QColor color = palette().color(QPalette::Text);
QPalette pal(this->palette());
pal.setColor(QPalette::Text, QColor(color));
m_labelTip->setPalette(pal);
}
m_labelTip->setText(m_strLoginTypeTip);
m_labelTip->show();
}
}
void MainWindow::startBioAuthDelay()
{
if (m_deviceInfo) {
if (m_deviceInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY) {
} else {
m_loginOptsWidget->startAuth(m_deviceInfo, getUid(userName));
}
switchLoginOptType(m_loginOptsWidget->convertDeviceType(m_deviceInfo->biotype));
} else {
switchLoginOptType(LOGINOPT_TYPE_PASSWORD);
}
m_bioTimer->stop();
}
void MainWindow::startBioAuth(unsigned uTimeout)
{
m_loginOptsWidget->stopAuth();
if (m_deviceInfo && m_deviceInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY) {
switchLoginOptType(m_loginOptsWidget->convertDeviceType(m_deviceInfo->biotype));
}
if (!m_bioTimer) {
m_bioTimer = new QTimer(this);
connect(m_bioTimer, SIGNAL(timeout()), this, SLOT(startBioAuthDelay()));
}
ui->lblMessage->clear();
ui->lblMessage->setToolTip("");
m_bioTimer->start(uTimeout);
}
void MainWindow::onUpdateBioAuthMsg(QString strMsg)
{
setMessage(strMsg, TRUE);
}
void MainWindow::updatePixmap()
{
ui->btnAuth->hide();
ui->btnAuth->setDisabled(true);
ui->btnLoading->show();
ui->lePassword->setDisabled(true);
ui->lePassword->setReadOnly(true);
QMatrix matrix;
matrix.rotate(90.0);
m_waitingPixmap = QtPixmapCompat::transformedPixmap(m_waitingPixmap, matrix, Qt::FastTransformation);
ui->btnLoading->setIcon(m_waitingPixmap);
}
void MainWindow::onUpdateWndSize(unsigned uLoginOptType, unsigned uLoginOptSize)
{
ui->lblContent->hide();
ui->lblHeader->adjustSize();
// 标题+间隔+内容头+间隔+类型提示+间隔+用户列表+间隔+
// (密码输入框+间隔+验证提示+间隔+授权按钮+边距)/ --仅密码方式
// (密码输入框+间隔+验证提示+间隔+登录选项+间隔+授权按钮+边距)/ --密码+生物识别 选择密码
// (登录选项+间隔+授权按钮+边距)/ --密码+生物识别 选择生物识别
// (ukey加载页+间隔+登录选项+间隔+授权按钮+边距)/(ukey认证页+间隔+登录选项+间隔+授权按钮+边距)
// --选择Ukey
int height = 40 + 8 + ui->lblHeader->height() + 8 + m_labelTip->height() + 8;
switch (m_uCurLoginOptType) {
case LOGINOPT_TYPE_PASSWORD: {
height += ui->cmbUsers->height() + 8 + ui->lePassword->height() + 8 + ui->lblMessage->height() + 8;
} break;
case LOGINOPT_TYPE_FACE:
case LOGINOPT_TYPE_FINGERPRINT:
case LOGINOPT_TYPE_FINGERVEIN:
case LOGINOPT_TYPE_IRIS:
case LOGINOPT_TYPE_VOICEPRINT:
case LOGINOPT_TYPE_QRCODE: {
height += ui->cmbUsers->height() + 8;
} break;
case LOGINOPT_TYPE_GENERAL_UKEY:
case LOGINOPT_TYPE_ADVANCED_UKEY: {
if (!ui->widgetUkeyAuth->isHidden()) {
height += ui->widgetUkeyAuth->height() + 8;
} else if (!ui->loadingUkeyWidget->isHidden()) {
height += ui->loadingUkeyWidget->height() + 8;
}
} break;
default:
break;
}
if (!m_loginOptsWidget->isHidden()) {
height += m_loginOptsWidget->height() + 8;
}
height += ui->btnAuth->height() + 24;
setFixedSize(width(), height);
qInfo() << "MainWindow geometry update:" << geometry() << height;
}
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;
}
void MainWindow::onOptionSelected(unsigned uCurLoginOptType, const DeviceInfoPtr &deviceInfo)
{
isLoadingUkey = false;
if (uCurLoginOptType == LOGINOPT_TYPE_GENERAL_UKEY) {
stopLoadingUkey();
}
if (uCurLoginOptType == LOGINOPT_TYPE_PASSWORD) {
switchLoginOptType(uCurLoginOptType);
if (m_loginOptsWidget) {
m_loginOptsWidget->stopAuth();
}
m_deviceInfo = nullptr;
authMode = PASSWORD;
emit restartAuth();
return;
}
if (uCurLoginOptType != LOGINOPT_TYPE_GENERAL_UKEY && !deviceInfo)
return;
if (deviceInfo)
qDebug() << "device changed: " << deviceInfo->biotype;
if (deviceInfo && m_failMap[getUid(userName)][deviceInfo->device_id] >= maxFailedTimes) {
qDebug() << "Failed MAX!!";
return;
}
if (uCurLoginOptType == LOGINOPT_TYPE_GENERAL_UKEY && !deviceInfo) {
isLoadingUkey = true;
startLoadingUkey();
m_loginOptsWidget->updateUkeyUIStatus(LOGINOPT_TYPE_GENERAL_UKEY);
} else if (uCurLoginOptType == LOGINOPT_TYPE_GENERAL_UKEY && deviceInfo) {
stopLoadingUkey();
m_loginOptsWidget->updateUkeyUIStatus(LOGINOPT_TYPE_GENERAL_UKEY);
}
if (deviceInfo == m_deviceInfo) {
return;
}
if (uCurLoginOptType != LOGINOPT_TYPE_GENERAL_UKEY && deviceInfo == m_deviceInfo) {
return;
}
if (m_bioTimer)
m_bioTimer->stop();
m_deviceInfo = deviceInfo;
switchLoginOptType(uCurLoginOptType);
if (!isbioSuccess && m_deviceInfo) {
startBioAuth();
}
}
void MainWindow::onNotifyOptionsChanged(unsigned uOptionsCount)
{
if (uOptionsCount > 0) {
m_loginOptsWidget->show();
} else {
// m_loginOptsWidget->hide();
}
if (m_deviceInfo && m_deviceInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY) {
stopLoadingUkey();
}
if (!m_deviceInfo || !m_loginOptsWidget->findDeviceById(m_deviceInfo->device_id)
|| m_loginOptsWidget->isDeviceDisable(m_deviceInfo->device_id)) {
m_loginOptsWidget->stopAuth();
if (authMode != UNDEFINED) {
authMode = UNDEFINED;
emit switchToBiometric();
}
}
}
void MainWindow::onLoginOptionsAuthCompleted(uid_t uid, bool ret, int nStatus)
{
qDebug() << "biometric authentication complete: " << uid << ret << nStatus;
if (m_deviceInfo && m_deviceInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY && ui->widgetUkeyAuth->isVisible()) {
ui->ukeyPassword->setText("");
}
if (uid == getUid(userName) && ret) {
isbioSuccess = true;
emit switchToBiometric();
authMode = UNDEFINED;
} else {
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) {
uid_t curUid = getUid(userName);
if (m_failMap.contains(curUid) && m_failMap[curUid].contains(m_deviceInfo->device_id)) {
m_failMap[curUid][m_deviceInfo->device_id] = m_failMap[curUid][m_deviceInfo->device_id] + 1;
} else {
m_failMap[curUid][m_deviceInfo->device_id] = 1;
}
qDebug() << "Failed count:" << m_failMap[curUid][m_deviceInfo->device_id]
<< ",Max:" << maxFailedTimes;
if (m_deviceInfo->biotype == BIOTYPE_FACE) {
QImage imgFailed;
m_loginOptsWidget->setFaceImg(imgFailed, 1);
}
if (m_failMap[curUid][m_deviceInfo->device_id] >= maxFailedTimes) {
no_changes = true;
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)));
QImage nullImage;
m_loginOptsWidget->setQRCode(nullImage);
} else if (m_deviceInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY) {
ui->ukeyPassword->setReadOnly(true);
setUkeyTypeTip(tr("Unable to verify %1, please enter password to unlock")
.arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype)));
} else {
setLoginTypeTip(tr("Unable to verify %1, please enter password to unlock")
.arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype)));
m_loginOptsWidget->stopBioWaiting(true);
}
m_loginOptsWidget->setDeviceDisable(m_deviceInfo->device_id, true);
useDoubleAuth = false;
return;
}
no_changes = false;
if (m_deviceInfo->biotype == LOGINOPT_TYPE_GENERAL_UKEY) {
setUkeyTypeTip(tr("Failed to verify %1, you still have %2 verification opportunities")
.arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype))
.arg(maxFailedTimes - m_failMap[curUid][m_deviceInfo->device_id]));
} else {
setLoginTypeTip(tr("Failed to verify %1, you still have %2 verification opportunities")
.arg(BioDevices::bioTypeToString_tr(m_deviceInfo->biotype))
.arg(maxFailedTimes - m_failMap[curUid][m_deviceInfo->device_id]));
}
}
}
if (!isbioSuccess) {
// dbus error
if (nStatus == -1) {
qDebug() << "Biometric dbus error:" << authMode;
}
if (m_uCurLoginOptType == LOGINOPT_TYPE_QRCODE && nStatus == 1) {
m_isNetworkErr = true;
m_loginOptsWidget->setQRCodeMsg(tr("Abnormal network"));
startBioAuth(10000);
} else if (m_uCurLoginOptType == LOGINOPT_TYPE_QRCODE && nStatus == -4) {
m_isNetworkErr = true;
m_loginOptsWidget->setQRCodeMsg(tr("Acquisition failure"));
startBioAuth(10000);
} else {
startBioAuth();
}
if (nStatus >= 2 && m_deviceInfo) {
if (m_deviceInfo->biotype == BIOTYPE_FACE) {
QImage imgFailed;
m_loginOptsWidget->setFaceImg(imgFailed, 1);
}
}
}
}
}
void MainWindow::updateAuthMethod()
{
authMethod = getAuthMethod();
}
QString MainWindow::getAuthMethod()
{
QDBusInterface interface(
"com.kylin.pwdless.daemon", "/", "com.kylin.pwdless.daemon", QDBusConnection::systemBus(), this);
if (!interface.isValid()) {
return "";
}
QDBusMessage result = interface.call(QStringLiteral("mfaStatus"));
if (result.type() == QDBusMessage::ErrorMessage) {
qWarning() << "mfaStatus error:" << result.errorMessage();
return "";
}
int ret = result.arguments().at(0).toInt();
QString method = result.arguments().at(1).toString();
if (ret == 0)
return "";
else
return method;
}
void MainWindow::resetSendPassword()
{
hasSendPassword = false;
}
bool MainWindow::checkIsAdmin(QString userName)
{
int ngroups = 512;
struct passwd *pw;
struct group *gr;
gid_t groups[512];
pw = getpwnam(userName.toLocal8Bit().data());
if (pw == NULL) {
qDebug() << userName << "is not exists";
return false;
}
if (getgrouplist(pw->pw_name, pw->pw_gid, groups, &ngroups) == -1) {
qDebug() << userName << "get group failed";
return false;
}
for (size_t j = 0; j < ngroups; j++) {
gr = getgrgid(groups[j]);
if (gr != NULL) {
if (strcmp("sudo", gr->gr_name) == 0)
return true;
}
}
return false;
}
/*** end of private member ***/
ukui-biometric-auth/polkit-agent/src/types.h 0000664 0001750 0001750 00000004062 15167732630 020105 0 ustar feng feng /*
* Copyright (C) 2023 KylinSoftCo., 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 .
*
**/
#ifndef TYPES_H
#define TYPES_H
/* https://www.narf.ssji.net/~shtrom/wiki/projets/gnomescreensavernosession */
enum SessionStatus
{
SESSION_AVAILABLE = 0,
SESSION_INVISIBLE = 1,
SESSION_BUSY = 2,
SESSION_IDLE = 3
};
enum ScreenStatus
{
UNDEFINED = 0x00,
SCREEN_SAVER = 0x01,
SCREEN_LOCK = 0x02
};
#define SM_DBUS_SERVICE "org.gnome.SessionManager"
#define SM_DBUS_PATH "/org/gnome/SessionManager/Presence"
#define SM_DBUS_INTERFACE "org.gnome.SessionManager.Presence"
#define DM_DBUS_SERVICE "org.freedesktop.DisplayManager"
#define DM_DBUS_PATH "/org/freedesktop/DisplayManager"
#define DM_DBUS_INTERFACE "org.freedesktop.DisplayManager"
#define DM_SEAT_INTERFACE "org.freedesktop.DisplayManager.Seat"
#define ACT_DBUS_SERVICE "org.freedesktop.Accounts"
#define ACT_DBUS_PATH "/org/freedesktop/Accounts"
#define ACT_DBUS_INTERFACE "org.freedesktop.Accounts"
#define ACT_USER_INTERFACE "org.freedesktop.Accounts.User"
#define DBUS_PROP_INTERFACE "org.freedesktop.DBus.Properties"
#define SS_DBUS_SERVICE "org.ukui.ScreenSaver"
#define SS_DBUS_PATH "/"
#define SS_DBUS_INTERFACE "org.ukui.ScreenSaver"
#define BIO_ERROR -1
#define BIO_FAILED 0
#define BIO_SUCCESS 1
#define BIO_IGNORE 2
#define BIOMETRIC_PAM "BIOMETRIC_PAM"
#define BIOMETRIC_IGNORE "BIOMETRIC_IGNORE"
#define BIOMETRIC_SUCCESS "BIOMETRIC_SUCCESS"
#define BIOMETRIC_FAILED "BIOMETRIC_FAILED"
#endif // TYPES_H
ukui-biometric-auth/polkit-agent/src/kalabel.h 0000664 0001750 0001750 00000002135 15167732630 020333 0 ustar feng feng /*
* Copyright (C) 2023 KylinSoftCo., 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 .
*
**/
#ifndef KALABEL_H
#define KALABEL_H
#include
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
ukui-biometric-auth/polkit-agent/src/modeButton.cpp 0000664 0001750 0001750 00000011543 15167732630 021416 0 ustar feng feng /*
* Copyright (C) 2023 KylinSoftCo., 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 .
*
**/
#include "modeButton.h"
#include
#include
#include
#include
#include
ModeButton::ModeButton(QWidget *parent)
: QPushButton(parent)
{
m_strIcon = "";
m_strText = "";
this->setFlat(true);
initUI();
initStyleTheme();
}
ModeButton::ModeButton(QString strIcon, QWidget *parent)
: QPushButton(parent)
{
m_strIcon = strIcon;
this->setFlat(true);
initUI();
initStyleTheme();
}
ModeButton::~ModeButton()
{
if (m_styleSettings) {
delete m_styleSettings;
m_styleSettings = nullptr;
}
}
void ModeButton::initUI()
{
installEventFilter(this);
setModeIcon();
setFixedSize(QSize(24, 24));
setModeIcon();
setCursor(Qt::ArrowCursor);
setStyleSheet("QPushButton::pressed{border:none;background-color:transparent}"
"QPushButton::hover::!pressed{border:none;background-color:transparent}");
connect(this, &QPushButton::clicked, this, [=](){
if (!pwdShow) {
pwdShow = true;
setModeIcon();
} else {
pwdShow = false;
setModeIcon();
}
});
}
void ModeButton::initStyleTheme()
{
const QByteArray idd("org.ukui.style");
if(QGSettings::isSchemaInstalled(idd)) {
m_styleSettings = new QGSettings(idd);
}
if (m_styleSettings) {
connect(m_styleSettings, &QGSettings::changed, this, [=](const QString &key) {
if (key == "styleName") {
auto styleNameValue = m_styleSettings->get("styleName");
if (styleNameValue.isValid()) {
m_strThemeName = styleNameValue.toString();
setModeIcon();
}
}
});
auto styleNameValue = m_styleSettings->get("styleName");
if (styleNameValue.isValid()) {
m_strThemeName = styleNameValue.toString();
}
}
}
void ModeButton::setModeIcon()
{
QIcon icon;
QPixmap pixmap;
if(pwdShow){
icon = QIcon::fromTheme("ukui-eye-display-symbolic");
pixmap = icon.pixmap(QSize(24,24));
} else{
icon = QIcon::fromTheme("ukui-eye-hidden-symbolic");
pixmap = icon.pixmap(QSize(24,24));
}
if(m_isHover)
pixmap = drawSymbolicColoredPixmap(pixmap, "white");
else
pixmap = drawSymbolicColoredPixmap(pixmap, "gray");
if(m_strThemeName == "ukui-dark" || m_strThemeName == "ukui-black")
this->setIcon(pixmap);
else
this->setIcon(icon);
}
bool ModeButton::eventFilter(QObject *obj, QEvent *event)
{
if(obj == this){
if(event->type() == QEvent::Enter){
m_isHover = true;
setModeIcon();
} else if(event->type() == QEvent::Leave){
m_isHover = false;
setModeIcon();
}
}
return QPushButton::eventFilter(obj, event);
}
QPixmap ModeButton::drawSymbolicColoredPixmap(QPixmap &source, QString cgColor)
{
QImage img = source.toImage();
for (int x = 0; x < img.width(); x++) {
for (int y = 0; y < img.height(); y++) {
auto color = img.pixelColor(x, y);
if (color.alpha() > 0) {
if ( "white" == cgColor) {
color.setRed(255);
color.setGreen(255);
color.setBlue(255);
img.setPixelColor(x, y, color);
} else if( "black" == cgColor) {
color.setRed(0);
color.setGreen(0);
color.setBlue(0);
img.setPixelColor(x, y, color);
} else if ("gray"== cgColor) {
color.setRed(152);
color.setGreen(163);
color.setBlue(164);
img.setPixelColor(x, y, color);
} else if ("blue" == cgColor){
color.setRed(61);
color.setGreen(107);
color.setBlue(229);
img.setPixelColor(x, y, color);
} else {
return source;
}
}
}
}
return QPixmap::fromImage(img);
}
bool ModeButton::isShowPwd()
{
return pwdShow;
}
ukui-biometric-auth/polkit-agent/src/PolkitAgent.cpp 0000664 0001750 0001750 00000004736 15167732644 021532 0 ustar feng feng /*
* Copyright (C) 2023 KylinSoftCo., 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 .
*
**/
#include
#include
#include
#include "PolkitListener.h"
#include "generic.h"
#include "sessionmanager.h"
#include "biodevices.h"
#include
bool enableDebug;
QString logPrefix;
int main(int argc, char *argv[])
{
enableDebug = true;
logPrefix = "[ukui-polkit]:";
//qInstallMessageHandler(outputMessage);
initUkuiLog4qt("ukui-polkit");
qDebug() << "Polkit Agent Started";
#if(QT_VERSION>=QT_VERSION_CHECK(5,6,0))
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
QApplication agent(argc, argv);
QString locale = QLocale::system().name();
qDebug() << "Language: " <