2 * Copyright 2014, Stephan Aßmus <superstippi@gmx.de>.
3 * All rights reserved. Distributed under the terms of the MIT License.
5 #ifndef USER_LOGIN_WINDOW_H
6 #define USER_LOGIN_WINDOW_H
12 #include "PackageInfo.h"
23 class UserLoginWindow
: public BWindow
{
25 UserLoginWindow(BWindow
* parent
, BRect frame
,
27 virtual ~UserLoginWindow();
29 virtual void MessageReceived(BMessage
* message
);
31 void SetOnSuccessMessage(
32 const BMessenger
& messenger
,
33 const BMessage
& message
);
42 void _SetMode(Mode mode
);
43 bool _ValidateCreateAccountFields(
44 bool alertProblems
= false);
46 void _CreateAccount();
47 void _RequestCaptcha();
48 void _LoginSuccessful(const BString
& message
);
50 void _SetWorkerThread(thread_id thread
);
52 static int32
_AuthenticateThreadEntry(void* data
);
53 void _AuthenticateThread();
55 static int32
_RequestCaptchaThreadEntry(void* data
);
56 void _RequestCaptchaThread();
58 static int32
_CreateAccountThreadEntry(void* data
);
59 void _CreateAccountThread();
61 void _CollectValidationFailures(
62 const BMessage
& result
,
63 BString
& error
) const;
66 BMessenger fOnSuccessTarget
;
67 BMessage fOnSuccessMessage
;
71 BTextControl
* fUsernameField
;
72 BTextControl
* fPasswordField
;
74 BTextControl
* fNewUsernameField
;
75 BTextControl
* fNewPasswordField
;
76 BTextControl
* fRepeatPasswordField
;
77 BTextControl
* fEmailField
;
78 BMenuField
* fLanguageCodeField
;
79 BitmapView
* fCaptchaView
;
80 BTextControl
* fCaptchaResultField
;
83 BButton
* fCancelButton
;
85 BString fCaptchaToken
;
86 BitmapRef fCaptchaImage
;
87 BString fPreferredLanguage
;
94 thread_id fWorkerThread
;
98 #endif // USER_LOGIN_WINDOW_H