on xenial help sign in
Make demo user a bit configurable as a stop-gap measure for design until lightdm lands
2f8dfa9Michael Terry
tests/mocks/LightDM/demo/GreeterPrivate.cpp+24−3
@@ -18,6 +18,8 @@
18
18
19#include "../Greeter.h"
19#include "../Greeter.h"
20#include "../GreeterPrivate.h"
20#include "../GreeterPrivate.h"
21+#include <QtCore/QDir>
22+#include <QtCore/QSettings>
21
23
22namespace QLightDM
24namespace QLightDM
23{
25{
@@ -33,13 +35,32 @@ void GreeterPrivate::handleAuthenticate()
33{
35{
34 Q_Q(Greeter);
36 Q_Q(Greeter);
35
37
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 {
36− authenticated = true;
46+ authenticated = true;
37− Q_EMIT q->authenticationComplete();
47+ Q_EMIT q->authenticationComplete();
48+ }
38}
49}
39
50
40void GreeterPrivate::handleRespond(const QString &response)
51void GreeterPrivate::handleRespond(const QString &response)
41{
52{
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();
43}
64}
44
65
45}
66}