@@ -19,6 +19,7 @@
19#include "../Greeter.h"
19#include "../Greeter.h"
20#include "../GreeterPrivate.h"
20#include "../GreeterPrivate.h"
21#include <QtCore/QDir>
21#include <QtCore/QDir>
22+#include <QtCore/QProcess>
22#include <QtCore/QSettings>
23#include <QtCore/QSettings>
24namespace QLightDM
25namespace QLightDM
@@ -55,15 +56,25 @@ void GreeterPrivate::handleRespond(const QString &response)
56 QSettings settings(QDir::homePath() + "/.unity8-greeter-demo", QSettings::NativeFormat);
57 QSettings settings(QDir::homePath() + "/.unity8-greeter-demo", QSettings::NativeFormat);
57 settings.beginGroup(authenticationUser);
58 settings.beginGroup(authenticationUser);
58− QVariant password = settings.value("password", "none");
59+ QVariant passwordValue(settings.value("passwordValue", QString()));
60+ QStringList passwordParts = passwordValue.toString().split('$', QString::SkipEmptyParts);
60− QString passwordValue;
62+ // We only support passwd type 6 (sha512) for now
61− if (password == "pin") {
63+ if (passwordParts.length() == 3 && passwordParts[0] == "6") {
62− passwordValue = settings.value("passwordValue", "1234").toString();
64+ QString command = "mkpasswd --method=sha-512 --stdin --salt=" + passwordParts[1];
67+ process.start(command);
68+ process.write(response.toLatin1());
69+ process.closeWriteChannel();
70+ process.waitForFinished();
72+ QString result = QString(process.readAllStandardOutput()).trimmed();
73+ authenticated = result == passwordValue;
64− passwordValue = settings.value("passwordValue", "password").toString();
75+ authenticated = false;
66− authenticated = (response == passwordValue);
77+
67 Q_EMIT q->authenticationComplete();
78 Q_EMIT q->authenticationComplete();