@@ -18,6 +18,8 @@
1818
1919#include "../Greeter.h"
2020#include "../GreeterPrivate.h"
21+#include <QtCore/QDir>
22+#include <QtCore/QSettings>
2123
2224namespace QLightDM
2325{
@@ -33,13 +35,32 @@ void GreeterPrivate::handleAuthenticate()
3335{
3436 Q_Q(Greeter);
3537
36− authenticated = true;
37− Q_EMIT q->authenticationComplete();
38+ QSettings settings(QDir::homePath() + "/.unity8-greeter-demo", QSettings::NativeFormat);
39+ QVariant password = settings.value("password", "none");
40+
41+ if (password == "pin") {
42+ Q_EMIT q->showPrompt("PIN", Greeter::PromptTypeSecret);
43+ } else if (password == "keyboard") {
44+ Q_EMIT q->showPrompt("Password", Greeter::PromptTypeSecret);
45+ } else {
46+ authenticated = true;
47+ Q_EMIT q->authenticationComplete();
48+ }
3849}
3950
4051void GreeterPrivate::handleRespond(const QString &response)
4152{
42− Q_UNUSED(response);
53+ Q_Q(Greeter);
54+
55+ QSettings settings(QDir::homePath() + "/.unity8-greeter-demo", QSettings::NativeFormat);
56+ QVariant password = settings.value("password", "none");
57+
58+ if (password == "pin") {
59+ authenticated = (response == "1234");
60+ } else {
61+ authenticated = (response == "password");
62+ }
63+ Q_EMIT q->authenticationComplete();
4364}
4465
4566}