fix(single login): single login
Description:单点登录迁移到后端 Log: 无
This commit is contained in:
parent
ed898eb625
commit
abf0e84fc3
|
@ -41,7 +41,7 @@
|
|||
#include <openssl/pem.h>
|
||||
|
||||
#define UKUI_GREETER "/usr/sbin/ukui-greeter"
|
||||
#define UKUI_SCREENSAVER "/usr/bin/ukui-screensaver-dialog"
|
||||
#define UKUI_SCREENSAVER "/usr/bin/ukui-screensaver-backend"
|
||||
|
||||
#define GREETER_DBUS_PATH "/"
|
||||
#define GREETER_DBUS_INTERFACE "org.ukui.greeter"
|
||||
|
@ -916,13 +916,13 @@ bool ServiceInterface::sendPassword(QString username,QByteArray password)
|
|||
rsac.decrypt(password, decryptText, priKey); // 解密
|
||||
//如果处于登录状态
|
||||
|
||||
qDebug()<<"sendPassword"<<loginAppList.count();
|
||||
qDebug()<<"sendPassword"<<loginAppList.count()<<loginAppList;
|
||||
if(loginAppList.contains("lightdm")){
|
||||
qDebug()<<"login:";
|
||||
isFirstLogin = false;
|
||||
QString publicKey = getLoginPubKey(loginAppList.value("lightdm"),GREETER_DBUS_PATH,GREETER_DBUS_INTERFACE);
|
||||
QString publicKey = getLoginPubKey(loginAppList.value("lightdm"),SCREENSAVER_DBUS_PATH,SCREENSAVER_DBUS_INTERFACE);
|
||||
rsac.encrypt(decryptText, encryptText, publicKey.toLatin1());
|
||||
return sendLoginPassword(loginAppList.value("lightdm"),GREETER_DBUS_PATH,GREETER_DBUS_INTERFACE,username,encryptText);
|
||||
return sendLoginPassword(loginAppList.value("lightdm"),SCREENSAVER_DBUS_PATH,SCREENSAVER_DBUS_INTERFACE,username,encryptText);
|
||||
}
|
||||
|
||||
//处于锁屏状态
|
||||
|
@ -934,6 +934,14 @@ bool ServiceInterface::sendPassword(QString username,QByteArray password)
|
|||
return sendLoginPassword(loginAppList.value(username),SCREENSAVER_DBUS_PATH,SCREENSAVER_DBUS_INTERFACE,username,encryptText);
|
||||
}
|
||||
|
||||
if(loginAppList.count()>0){
|
||||
qDebug()<<"login by screensaver:";
|
||||
isFirstLogin = false;
|
||||
QString publicKey = getLoginPubKey(loginAppList.value(loginAppList.firstKey()),SCREENSAVER_DBUS_PATH,SCREENSAVER_DBUS_INTERFACE);
|
||||
rsac.encrypt(decryptText, encryptText, publicKey.toLatin1());
|
||||
return sendLoginPassword(loginAppList.value(loginAppList.firstKey()),SCREENSAVER_DBUS_PATH,SCREENSAVER_DBUS_INTERFACE,username,encryptText);
|
||||
}
|
||||
|
||||
//如果是第一次调用,则配置自动登录
|
||||
if(isFirstLogin){
|
||||
qDebug()<<"isFirstLogin:";
|
||||
|
@ -965,13 +973,13 @@ bool ServiceInterface::handleFirstSingleLogn(QString username,QByteArray decrypt
|
|||
qDebug()<<loginAppList.count();
|
||||
if(loginAppList.contains("lightdm")){
|
||||
isFirstLogin = false;
|
||||
QString publicKey = getLoginPubKey(loginAppList.value("lightdm"),GREETER_DBUS_PATH,GREETER_DBUS_INTERFACE);
|
||||
QString publicKey = getLoginPubKey(loginAppList.value("lightdm"),SCREENSAVER_DBUS_PATH,SCREENSAVER_DBUS_INTERFACE);
|
||||
if(publicKey.isEmpty()){
|
||||
qDebug()<<"get Login PubKey failed!";
|
||||
return false;
|
||||
}
|
||||
rsac.encrypt(decryptText, encryptText, publicKey.toLatin1());
|
||||
return sendLoginPassword(loginAppList.value("lightdm"),GREETER_DBUS_PATH,GREETER_DBUS_INTERFACE,username,encryptText);
|
||||
return sendLoginPassword(loginAppList.value("lightdm"),SCREENSAVER_DBUS_PATH,SCREENSAVER_DBUS_INTERFACE,username,encryptText);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -1018,7 +1026,6 @@ bool ServiceInterface::sendLoginPassword(QString service,QString path,QString i
|
|||
path,
|
||||
interface,
|
||||
QDBusConnection::systemBus());
|
||||
|
||||
QDBusReply<bool> stateReply = iface.call("sendPassword",username,array);
|
||||
if(!stateReply.isValid()){
|
||||
disconnect(connection);
|
||||
|
|
Loading…
Reference in New Issue