Merge lp:~azzar1/unity/fix-missing-entry-lockscreen into lp:unity

Proposed by Andrea Azzarone on 2017-09-15
Status: Merged
Approved by: Marco Trevisan (Treviño) on 2017-09-20
Approved revision: 4256
Merged at revision: 4257
Proposed branch: lp:~azzar1/unity/fix-missing-entry-lockscreen
Merge into: lp:unity
Diff against target: 558 lines (+144/-86)
12 files modified
lockscreen/KylinUserPromptView.cpp (+15/-15)
lockscreen/KylinUserPromptView.h (+2/-3)
lockscreen/LockScreenAbstractPromptView.h (+5/-3)
lockscreen/LockScreenController.cpp (+3/-1)
lockscreen/LockScreenController.h (+2/-0)
lockscreen/LockScreenPromptFactory.cpp (+4/-3)
lockscreen/LockScreenPromptFactory.h (+3/-1)
lockscreen/UserAuthenticator.h (+2/-0)
lockscreen/UserAuthenticatorPam.cpp (+41/-33)
lockscreen/UserAuthenticatorPam.h (+9/-8)
lockscreen/UserPromptView.cpp (+51/-15)
lockscreen/UserPromptView.h (+7/-4)
To merge this branch: bzr merge lp:~azzar1/unity/fix-missing-entry-lockscreen
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) 2017-09-15 Approve on 2017-09-18
Review via email: mp+330801@code.launchpad.net

Commit message

Refactor the way UserAuthenticator is created and passed around. Handle failures to create new threads and fallback to a "Switch to greeter..." button in case of failure.

To post a comment you must log in.
4255. By Andrea Azzarone on 2017-09-15

Remove space between function and (. Rename AuthenticationThred to AuthenticationThreadFunc too

4256. By Andrea Azzarone on 2017-09-15

Reset num_retry_auth_ when we show the swith-to-greeter button.

Marco Trevisan (Treviño) (3v1n0) wrote :

Looks good, thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lockscreen/KylinUserPromptView.cpp'
2--- lockscreen/KylinUserPromptView.cpp 2016-03-31 05:57:11 +0000
3+++ lockscreen/KylinUserPromptView.cpp 2017-09-15 13:37:27 +0000
4@@ -79,9 +79,9 @@
5
6 }
7
8-KylinUserPromptView::KylinUserPromptView(session::Manager::Ptr const& session_manager)
9- : AbstractUserPromptView(session_manager)
10- , session_manager_(session_manager)
11+KylinUserPromptView::KylinUserPromptView(session::Manager::Ptr const& session_manager,
12+ UserAuthenticator::Ptr const& user_authenticator)
13+ : AbstractUserPromptView(session_manager, user_authenticator)
14 , username_(nullptr)
15 , msg_layout_(nullptr)
16 , prompt_layout_(nullptr)
17@@ -90,25 +90,25 @@
18 , avatar_(nullptr)
19 , avatar_icon_file("")
20 {
21- user_authenticator_.echo_on_requested.connect([this](std::string const& message, PromiseAuthCodePtr const& promise){
22+ user_authenticator_->echo_on_requested.connect(sigc::track_obj([this](std::string const& message, PromiseAuthCodePtr const& promise){
23 AddPrompt(message, true, promise);
24- });
25+ }, *this));
26
27- user_authenticator_.echo_off_requested.connect([this](std::string const& message, PromiseAuthCodePtr const& promise){
28+ user_authenticator_->echo_off_requested.connect(sigc::track_obj([this](std::string const& message, PromiseAuthCodePtr const& promise){
29 AddPrompt(message, false, promise);
30- });
31+ }, *this));
32
33- user_authenticator_.message_requested.connect([this](std::string const& message){
34+ user_authenticator_->message_requested.connect(sigc::track_obj([this](std::string const& message){
35 AddMessage(message, nux::color::White);
36- });
37+ }, *this));
38
39- user_authenticator_.error_requested.connect([this](std::string const& message){
40+ user_authenticator_->error_requested.connect(sigc::track_obj([this](std::string const& message){
41 AddMessage(message, nux::color::Red);
42- });
43+ }, *this));
44
45- user_authenticator_.clear_prompts.connect([this](){
46+ user_authenticator_->clear_prompts.connect(sigc::track_obj([this](){
47 ResetLayout();
48- });
49+ }, *this));
50
51 scale.changed.connect(sigc::hide(sigc::mem_fun(this, &KylinUserPromptView::UpdateSize)));
52
53@@ -121,7 +121,7 @@
54 ResetLayout();
55
56 TextureCache::GetDefault().themed_invalidated.connect(sigc::mem_fun(this, &KylinUserPromptView::ResetLayout));
57- user_authenticator_.AuthenticateStart(session_manager_->UserName(),
58+ user_authenticator_->AuthenticateStart(session_manager_->UserName(),
59 sigc::mem_fun(this, &KylinUserPromptView::AuthenticationCb));
60 }
61
62@@ -244,7 +244,7 @@
63 {
64 AddMessage(_("Invalid password, please try again"), nux::color::Red);
65
66- user_authenticator_.AuthenticateStart(session_manager_->UserName(),
67+ user_authenticator_->AuthenticateStart(session_manager_->UserName(),
68 sigc::mem_fun(this, &KylinUserPromptView::AuthenticationCb));
69 }
70 }
71
72=== modified file 'lockscreen/KylinUserPromptView.h'
73--- lockscreen/KylinUserPromptView.h 2016-03-16 10:47:16 +0000
74+++ lockscreen/KylinUserPromptView.h 2017-09-15 13:37:27 +0000
75@@ -44,7 +44,8 @@
76 class KylinUserPromptView : public AbstractUserPromptView
77 {
78 public:
79- KylinUserPromptView(session::Manager::Ptr const& session_manager);
80+ KylinUserPromptView(session::Manager::Ptr const& session_manager,
81+ UserAuthenticator::Ptr const& user_authenticator);
82
83 nux::View* focus_view();
84
85@@ -62,8 +63,6 @@
86 nux::ObjectPtr<nux::BaseTexture> LoadUserIcon(std::string const& icon_file, int icon_size);
87
88 private:
89- session::Manager::Ptr session_manager_;
90- UserAuthenticatorPam user_authenticator_;
91 StaticCairoText* username_;
92 nux::VLayout* msg_layout_;
93 nux::VLayout* prompt_layout_;
94
95=== modified file 'lockscreen/LockScreenAbstractPromptView.h'
96--- lockscreen/LockScreenAbstractPromptView.h 2016-03-31 09:51:33 +0000
97+++ lockscreen/LockScreenAbstractPromptView.h 2017-09-15 13:37:27 +0000
98@@ -29,7 +29,7 @@
99 #include <Nux/VLayout.h>
100 #include "UnityCore/SessionManager.h"
101
102-#include "UserAuthenticatorPam.h"
103+#include "UserAuthenticator.h"
104 #include "unity-shared/IMTextEntry.h"
105
106 namespace nux
107@@ -48,10 +48,12 @@
108 class AbstractUserPromptView : public nux::View
109 {
110 public:
111- AbstractUserPromptView(session::Manager::Ptr const& session_manager)
112+ AbstractUserPromptView(session::Manager::Ptr const& session_manager,
113+ UserAuthenticator::Ptr const& user_authenticator)
114 : nux::View(NUX_TRACKER_LOCATION)
115 , scale(1.0)
116 , session_manager_(session_manager)
117+ , user_authenticator_(user_authenticator)
118 {}
119
120 nux::Property<double> scale;
121@@ -64,7 +66,7 @@
122
123 protected:
124 session::Manager::Ptr session_manager_;
125- UserAuthenticatorPam user_authenticator_;
126+ UserAuthenticator::Ptr user_authenticator_;
127 std::shared_ptr<nux::AbstractPaintLayer> bg_layer_;
128 StaticCairoText* username_;
129 nux::VLayout* msg_layout_;
130
131=== modified file 'lockscreen/LockScreenController.cpp'
132--- lockscreen/LockScreenController.cpp 2016-11-11 16:00:53 +0000
133+++ lockscreen/LockScreenController.cpp 2017-09-15 13:37:27 +0000
134@@ -27,6 +27,7 @@
135 #include "LockScreenPromptFactory.h"
136 #include "LockScreenShield.h"
137 #include "LockScreenSettings.h"
138+#include "UserAuthenticatorPam.h"
139 #include "unity-shared/AnimationUtils.h"
140 #include "unity-shared/InputMonitor.h"
141 #include "unity-shared/UnitySettings.h"
142@@ -70,6 +71,7 @@
143 , upstart_wrapper_(upstart_wrapper)
144 , shield_factory_(shield_factory)
145 , suspend_inhibitor_manager_(std::make_shared<SuspendInhibitorManager>())
146+ , user_authenticator_(std::make_shared<UserAuthenticatorPam>())
147 , fade_animator_(unity::Settings::Instance().low_gfx() ? 0 : LOCK_FADE_DURATION)
148 , blank_window_animator_(IDLE_FADE_DURATION)
149 , test_mode_(test_mode)
150@@ -259,7 +261,7 @@
151
152 if (!prompt_view)
153 {
154- prompt_view = test_mode_ ? nux::ObjectPtr<AbstractUserPromptView>() : PromptFactory::CreatePrompt(session_manager_);
155+ prompt_view = test_mode_ ? nux::ObjectPtr<AbstractUserPromptView>() : PromptFactory::CreatePrompt(session_manager_, user_authenticator_);
156 prompt_view_ = prompt_view.GetPointer();
157 }
158
159
160=== modified file 'lockscreen/LockScreenController.h'
161--- lockscreen/LockScreenController.h 2016-11-11 16:00:53 +0000
162+++ lockscreen/LockScreenController.h 2017-09-15 13:37:27 +0000
163@@ -29,6 +29,7 @@
164 #include "LockScreenAcceleratorController.h"
165 #include "SuspendInhibitorManager.h"
166 #include "ScreenSaverDBusManager.h"
167+#include "UserAuthenticator.h"
168 #include "unity-shared/BackgroundEffectHelper.h"
169 #include "unity-shared/SystemdWrapper.h"
170 #include "unity-shared/UpstartWrapper.h"
171@@ -95,6 +96,7 @@
172 UpstartWrapper::Ptr upstart_wrapper_;
173 ShieldFactoryInterface::Ptr shield_factory_;
174 SuspendInhibitorManager::Ptr suspend_inhibitor_manager_;
175+ UserAuthenticator::Ptr user_authenticator_;
176
177 nux::animation::AnimateValue<double> fade_animator_;
178 nux::animation::AnimateValue<double> blank_window_animator_;
179
180=== modified file 'lockscreen/LockScreenPromptFactory.cpp'
181--- lockscreen/LockScreenPromptFactory.cpp 2015-12-04 08:17:46 +0000
182+++ lockscreen/LockScreenPromptFactory.cpp 2017-09-15 13:37:27 +0000
183@@ -26,14 +26,15 @@
184 {
185 namespace lockscreen
186 {
187-nux::ObjectPtr<AbstractUserPromptView> PromptFactory::CreatePrompt(session::Manager::Ptr const& sm)
188+nux::ObjectPtr<AbstractUserPromptView> PromptFactory::CreatePrompt(session::Manager::Ptr const& sm,
189+ UserAuthenticator::Ptr const& ua)
190 {
191 nux::ObjectPtr<AbstractUserPromptView> prompt;
192
193 if (unity::Settings::Instance().desktop_type() == DesktopType::UBUNTUKYLIN)
194- prompt = new KylinUserPromptView(sm);
195+ prompt = new KylinUserPromptView(sm, ua);
196 else
197- prompt = new UserPromptView(sm);
198+ prompt = new UserPromptView(sm, ua);
199
200 return prompt;
201 }
202
203=== modified file 'lockscreen/LockScreenPromptFactory.h'
204--- lockscreen/LockScreenPromptFactory.h 2016-03-31 09:51:33 +0000
205+++ lockscreen/LockScreenPromptFactory.h 2017-09-15 13:37:27 +0000
206@@ -22,6 +22,7 @@
207
208 #include <NuxCore/NuxCore.h>
209 #include "UnityCore/SessionManager.h"
210+#include "UserAuthenticator.h"
211
212 namespace unity
213 {
214@@ -33,7 +34,8 @@
215
216 struct PromptFactory
217 {
218- static nux::ObjectPtr<AbstractUserPromptView> CreatePrompt(session::Manager::Ptr const&);
219+ static nux::ObjectPtr<AbstractUserPromptView> CreatePrompt(session::Manager::Ptr const&,
220+ UserAuthenticator::Ptr const&);
221 };
222
223 }
224
225=== modified file 'lockscreen/UserAuthenticator.h'
226--- lockscreen/UserAuthenticator.h 2014-03-05 04:09:13 +0000
227+++ lockscreen/UserAuthenticator.h 2017-09-15 13:37:27 +0000
228@@ -36,6 +36,7 @@
229 class UserAuthenticator
230 {
231 public:
232+ typedef std::shared_ptr<UserAuthenticator> Ptr;
233 typedef std::function<void(bool)> AuthenticateEndCallback;
234
235 virtual ~UserAuthenticator() = default;
236@@ -43,6 +44,7 @@
237 // Authenticate the user in a background thread.
238 virtual bool AuthenticateStart(std::string const& username, AuthenticateEndCallback const&) = 0;
239
240+ sigc::signal<void> start_failed;
241 sigc::signal<void, std::string, PromiseAuthCodePtr const&> echo_on_requested;
242 sigc::signal<void, std::string, PromiseAuthCodePtr const&> echo_off_requested;
243 sigc::signal<void, std::string> message_requested;
244
245=== modified file 'lockscreen/UserAuthenticatorPam.cpp'
246--- lockscreen/UserAuthenticatorPam.cpp 2016-08-10 08:56:27 +0000
247+++ lockscreen/UserAuthenticatorPam.cpp 2017-09-15 13:37:27 +0000
248@@ -23,6 +23,7 @@
249
250 #include "UserAuthenticatorPam.h"
251 #include "unity-shared/UnitySettings.h"
252+#include "UnityCore/GLibWrapper.h"
253
254 #include <cstring>
255 #include <security/pam_appl.h>
256@@ -36,42 +37,49 @@
257 bool UserAuthenticatorPam::AuthenticateStart(std::string const& username,
258 AuthenticateEndCallback const& authenticate_cb)
259 {
260+ if (pam_handle_)
261+ return false;
262+
263 first_prompt_ = true;
264 username_ = username;
265 authenticate_cb_ = authenticate_cb;
266- pam_handle_ = nullptr;
267-
268- if (!InitPam() || !pam_handle_)
269- return false;
270-
271- glib::Object<GTask> task(g_task_new(nullptr, cancellable_, [] (GObject*, GAsyncResult*, gpointer data) {
272- auto self = static_cast<UserAuthenticatorPam*>(data);
273- pam_end(self->pam_handle_, self->status_);
274- self->authenticate_cb_(self->status_ == PAM_SUCCESS);
275- }, this));
276-
277- g_task_set_task_data(task, this, nullptr);
278-
279- g_task_run_in_thread(task, [] (GTask* task, gpointer, gpointer data, GCancellable*) {
280- auto self = static_cast<UserAuthenticatorPam*>(data);
281-
282- self->status_ = pam_authenticate(self->pam_handle_, 0);
283-
284- if (self->status_ == PAM_SUCCESS)
285- {
286- int status2 = pam_acct_mgmt(self->pam_handle_, 0);
287-
288- if (status2 == PAM_NEW_AUTHTOK_REQD)
289- status2 = pam_chauthtok(self->pam_handle_, PAM_CHANGE_EXPIRED_AUTHTOK);
290-
291- if (unity::Settings::Instance().pam_check_account_type())
292- self->status_ = status2;
293-
294- pam_setcred(self->pam_handle_, PAM_REINITIALIZE_CRED);
295- }
296- });
297-
298- return true;
299+
300+ glib::Error error;
301+ g_thread_try_new(nullptr, AuthenticationThreadFunc, this, &error);
302+
303+ return !error;
304+}
305+
306+gpointer UserAuthenticatorPam::AuthenticationThreadFunc(gpointer data)
307+{
308+ auto self = static_cast<UserAuthenticatorPam*>(data);
309+
310+ if (!self->InitPam() || !self->pam_handle_)
311+ {
312+ self->pam_handle_ = nullptr;
313+ self->source_manager_.AddTimeout(0, [self] { self->start_failed.emit(); return false; });
314+ return nullptr;
315+ }
316+
317+ self->status_ = pam_authenticate(self->pam_handle_, 0);
318+
319+ if (self->status_ == PAM_SUCCESS)
320+ {
321+ int status2 = pam_acct_mgmt(self->pam_handle_, 0);
322+
323+ if (status2 == PAM_NEW_AUTHTOK_REQD)
324+ status2 = pam_chauthtok(self->pam_handle_, PAM_CHANGE_EXPIRED_AUTHTOK);
325+
326+ if (unity::Settings::Instance().pam_check_account_type())
327+ self->status_ = status2;
328+
329+ pam_setcred(self->pam_handle_, PAM_REINITIALIZE_CRED);
330+ }
331+
332+ pam_end(self->pam_handle_, self->status_);
333+ self->pam_handle_ = nullptr;
334+ self->source_manager_.AddTimeout(0, [self] { self->authenticate_cb_(self->status_ == PAM_SUCCESS); return false; });
335+ return nullptr;
336 }
337
338 bool UserAuthenticatorPam::InitPam()
339
340=== modified file 'lockscreen/UserAuthenticatorPam.h'
341--- lockscreen/UserAuthenticatorPam.h 2014-03-05 04:09:13 +0000
342+++ lockscreen/UserAuthenticatorPam.h 2017-09-15 13:37:27 +0000
343@@ -20,8 +20,6 @@
344 #ifndef UNITY_USER_AUTHENTICATOR_PAM_H
345 #define UNITY_USER_AUTHENTICATOR_PAM_H
346
347-#include <boost/noncopyable.hpp>
348-#include <UnityCore/GLibWrapper.h>
349 #include <UnityCore/GLibSource.h>
350
351 #include "UserAuthenticator.h"
352@@ -36,13 +34,17 @@
353 namespace lockscreen
354 {
355
356-class UserAuthenticatorPam : public UserAuthenticator, private boost::noncopyable
357+class UserAuthenticatorPam : public UserAuthenticator
358 {
359 public:
360+ UserAuthenticatorPam() = default;
361 bool AuthenticateStart(std::string const& username, AuthenticateEndCallback const&) override;
362
363 private:
364- // TODO (andy) move to pimpl
365+ UserAuthenticatorPam(UserAuthenticatorPam const&) = delete;
366+ UserAuthenticatorPam& operator=(UserAuthenticatorPam const&) = delete;
367+
368+ static gpointer AuthenticationThreadFunc(gpointer);
369 bool InitPam();
370
371 static int ConversationFunction(int num_msg,
372@@ -53,10 +55,9 @@
373 std::string username_;
374 AuthenticateEndCallback authenticate_cb_;
375
376- int status_;
377- bool first_prompt_;
378- pam_handle* pam_handle_;
379- glib::Cancellable cancellable_;
380+ int status_ = 0;
381+ bool first_prompt_ = true;
382+ pam_handle* pam_handle_ = nullptr;
383 glib::SourceManager source_manager_;
384 };
385
386
387=== modified file 'lockscreen/UserPromptView.cpp'
388--- lockscreen/UserPromptView.cpp 2016-06-23 14:51:42 +0000
389+++ lockscreen/UserPromptView.cpp 2017-09-15 13:37:27 +0000
390@@ -23,6 +23,7 @@
391 #include <glib/gi18n-lib.h>
392
393 #include <boost/algorithm/string/trim.hpp>
394+#include <NuxCore/Logger.h>
395 #include <Nux/VLayout.h>
396
397 #include "LockScreenSettings.h"
398@@ -38,6 +39,9 @@
399 {
400 namespace
401 {
402+
403+DECLARE_LOGGER(logger, "unity.lockscreen");
404+
405 const RawPixel PADDING = 10_em;
406 const RawPixel LAYOUT_MARGIN = 10_em;
407 const RawPixel MSG_LAYOUT_MARGIN = 15_em;
408@@ -101,41 +105,46 @@
409
410 }
411
412-UserPromptView::UserPromptView(session::Manager::Ptr const& session_manager)
413- : AbstractUserPromptView(session_manager)
414- , session_manager_(session_manager)
415+UserPromptView::UserPromptView(session::Manager::Ptr const& session_manager,
416+ UserAuthenticator::Ptr const& user_authenticator)
417+ : AbstractUserPromptView(session_manager, user_authenticator)
418 , username_(nullptr)
419 , msg_layout_(nullptr)
420 , prompt_layout_(nullptr)
421 , button_layout_(nullptr)
422 , prompted_(false)
423 , unacknowledged_messages_(false)
424+ , num_retry_auth_(0)
425 {
426- user_authenticator_.echo_on_requested.connect([this](std::string const& message, PromiseAuthCodePtr const& promise){
427+ user_authenticator_->start_failed.connect(sigc::track_obj([this](){
428+ HandleAuthenticationStartFailure();
429+ }, *this));
430+
431+ user_authenticator_->echo_on_requested.connect(sigc::track_obj([this](std::string const& message, PromiseAuthCodePtr const& promise){
432 prompted_ = true;
433 unacknowledged_messages_ = false;
434 AddPrompt(message, /* visible */ true, promise);
435- });
436+ }, *this));
437
438- user_authenticator_.echo_off_requested.connect([this](std::string const& message, PromiseAuthCodePtr const& promise){
439+ user_authenticator_->echo_off_requested.connect(sigc::track_obj([this](std::string const& message, PromiseAuthCodePtr const& promise){
440 prompted_ = true;
441 unacknowledged_messages_ = false;
442 AddPrompt(message, /* visible */ false, promise);
443- });
444+ }, *this));
445
446- user_authenticator_.message_requested.connect([this](std::string const& message){
447+ user_authenticator_->message_requested.connect(sigc::track_obj([this](std::string const& message){
448 unacknowledged_messages_ = true;
449 AddMessage(message, nux::color::White);
450- });
451+ }, *this));
452
453- user_authenticator_.error_requested.connect([this](std::string const& message){
454+ user_authenticator_->error_requested.connect(sigc::track_obj([this](std::string const& message){
455 unacknowledged_messages_ = true;
456 AddMessage(message, nux::color::Red);
457- });
458+ }, *this));
459
460- user_authenticator_.clear_prompts.connect([this](){
461+ user_authenticator_->clear_prompts.connect(sigc::track_obj([this](){
462 ResetLayout();
463- });
464+ }, *this));
465
466 scale.changed.connect(sigc::hide(sigc::mem_fun(this, &UserPromptView::UpdateSize)));
467
468@@ -469,8 +478,11 @@
469 prompted_ = false;
470 unacknowledged_messages_ = false;
471
472- user_authenticator_.AuthenticateStart(session_manager_->UserName(),
473- sigc::mem_fun(this, &UserPromptView::AuthenticationCb));
474+ if(!user_authenticator_->AuthenticateStart(session_manager_->UserName(),
475+ sigc::mem_fun(this, &UserPromptView::AuthenticationCb)))
476+ {
477+ HandleAuthenticationStartFailure();
478+ }
479 }
480
481 void UserPromptView::DoUnlock()
482@@ -478,5 +490,29 @@
483 session_manager_->unlock_requested.emit();
484 }
485
486+void UserPromptView::HandleAuthenticationStartFailure()
487+{
488+ ++num_retry_auth_;
489+
490+ if (num_retry_auth_ <= 5)
491+ {
492+ LOG_WARNING(logger) << "Failed to start the authentication process. Retrying for " << num_retry_auth_ << " time.";
493+ source_manager_.AddTimeout(100, [this] {
494+ StartAuthentication();
495+ return false;
496+ });
497+ }
498+ else
499+ {
500+ num_retry_auth_ = 0;
501+
502+ AddMessage(_("Authentication failure"), nux::color::Red);
503+ AddButton(_("Switch to greeter…"), [this] {
504+ session_manager_->SwitchToGreeter();
505+ });
506+ GetLayout()->AddLayout(button_layout_);
507+ }
508+}
509+
510 }
511 }
512
513=== modified file 'lockscreen/UserPromptView.h'
514--- lockscreen/UserPromptView.h 2016-06-23 14:51:42 +0000
515+++ lockscreen/UserPromptView.h 2017-09-15 13:37:27 +0000
516@@ -25,10 +25,10 @@
517
518 #include <Nux/Nux.h>
519 #include <Nux/View.h>
520+#include "UnityCore/GLibSource.h"
521 #include "UnityCore/SessionManager.h"
522
523 #include "LockScreenAbstractPromptView.h"
524-#include "UserAuthenticatorPam.h"
525 #include "unity-shared/IMTextEntry.h"
526
527 namespace nux
528@@ -48,7 +48,8 @@
529 class UserPromptView : public AbstractUserPromptView
530 {
531 public:
532- UserPromptView(session::Manager::Ptr const& session_manager);
533+ UserPromptView(session::Manager::Ptr const& session_manager,
534+ UserAuthenticator::Ptr const& user_authenticator);
535
536 nux::View* focus_view();
537
538@@ -70,9 +71,8 @@
539 void ShowAuthenticated(bool successful);
540 void StartAuthentication();
541 void DoUnlock();
542+ void HandleAuthenticationStartFailure();
543
544- session::Manager::Ptr session_manager_;
545- UserAuthenticatorPam user_authenticator_;
546 std::shared_ptr<nux::AbstractPaintLayer> bg_layer_;
547 StaticCairoText* username_;
548 nux::VLayout* msg_layout_;
549@@ -84,6 +84,9 @@
550
551 bool prompted_;
552 bool unacknowledged_messages_;
553+ int num_retry_auth_ = 0;
554+
555+ glib::SourceManager source_manager_;
556 };
557
558 }