diff options
author | Simon Rettberg | 2024-05-13 16:53:02 +0200 |
---|---|---|
committer | Simon Rettberg | 2024-05-13 16:53:02 +0200 |
commit | 1f49778cb04027b5b0d043f95561cb44c69b80f3 (patch) | |
tree | 2140f6fd1e26ef89316c5f636e9dd77b0c7411df /src/qrlogin.cpp | |
parent | Handle cow-token on QRCode login (diff) | |
download | slxgreeter-master.tar.gz slxgreeter-master.tar.xz slxgreeter-master.zip |
Diffstat (limited to 'src/qrlogin.cpp')
-rw-r--r-- | src/qrlogin.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/qrlogin.cpp b/src/qrlogin.cpp index 22ea7e9..c562e98 100644 --- a/src/qrlogin.cpp +++ b/src/qrlogin.cpp @@ -1,5 +1,6 @@ #include "qrlogin.h" #include "settings.h" +#include "global.h" #include <unistd.h> @@ -155,15 +156,9 @@ void QrLogin::renderReceivedSvg() void QrLogin::handleAuthReceived(const QStringList &lines) { if (lines.size() >= 2) { - if (lines.size() >= 3) { + if (lines.size() >= 3 && !lines[2].isEmpty()) { // Admin token for editing VMs - QString userHash = QString::fromLocal8Bit(QCryptographicHash::hash(lines[0].toLocal8Bit(), QCryptographicHash::Md5).toHex()); - QFile file(QLatin1String("/run/openslx/lightdm/") + userHash); - if (file.open(QFile::WriteOnly | QFile::Truncate)) { - file.write(lines[2].toLocal8Bit()); - file.close(); - file.setPermissions(QFileDevice::ReadOwner | QFileDevice::WriteOwner); - } + Global::writeCowToken(lines[0], lines[2]); } emit startAuthentication(lines[0], QLatin1String("shib=") + lines[1]); } else { |