2 * Copyright (C) 2013 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 * Author: Michael Terry <michael.terry@canonical.com>
19#include "../Greeter.h"
20#include "../GreeterPrivate.h"
25GreeterPrivate::GreeterPrivate(Greeter* parent)
26 : authenticated(false),
33void GreeterPrivate::handleAuthenticate()
37 // Send out any messages we need to
38 if (authenticationUser == "info-prompt")
39 Q_EMIT q->showMessage("Welcome to Unity Greeter", Greeter::MessageTypeInfo);
40 else if (authenticationUser == "wide-info-prompt")
41 Q_EMIT q->showMessage("Welcome to Unity Greeter, the greeteriest greeter that ever did appear in these fine lands", Greeter::MessageTypeInfo);
42 else if (authenticationUser == "html-info-prompt")
43 Q_EMIT q->showMessage("<b>&</b>", Greeter::MessageTypeInfo);
44 else if (authenticationUser == "long-info-prompt")
45 Q_EMIT q->showMessage("Welcome to Unity Greeter\n\nWe like to annoy you with super ridiculously long messages.\nLike this one\n\nThis is the last line of a multiple line message.", Greeter::MessageTypeInfo);
46 else if (authenticationUser == "multi-info-prompt") {
47 Q_EMIT q->showMessage("Welcome to Unity Greeter", Greeter::MessageTypeInfo);
48 Q_EMIT q->showMessage("This is an error", Greeter::MessageTypeError);
49 Q_EMIT q->showMessage("You should have seen three messages", Greeter::MessageTypeInfo);
52 // OK, now actually do the prompt
53 if (authenticationUser == "no-password") {
55 Q_EMIT q->authenticationComplete();
56 } else if (authenticationUser == "has-pin"){
57 Q_EMIT q->showPrompt("PIN", Greeter::PromptTypeSecret);
58 } else if (authenticationUser == "auth-error") {
59 authenticated = false;
60 Q_EMIT q->authenticationComplete();
61 } else if (authenticationUser == "different-prompt") {
62 Q_EMIT q->showPrompt("Secret word: ", Greeter::PromptTypeSecret);
64 Q_EMIT q->showPrompt("Password: ", Greeter::PromptTypeSecret);
68void GreeterPrivate::handleRespond(const QString &response)
72 if (authenticationUser == "no-response")
74 else if (authenticationUser == "two-factor") {
76 if (response == "password") {
78 Q_EMIT q->showPrompt("otp", Greeter::PromptTypeQuestion);
80 authenticated = false;
81 Q_EMIT q->authenticationComplete();
84 authenticated = (response == "otp");
85 Q_EMIT q->authenticationComplete();
90 if (authenticationUser == "has-pin") {
91 authenticated = (response == "1234");
93 authenticated = (response == "password");
95 Q_EMIT q->authenticationComplete();
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list