1
// Berkeley Open Infrastructure for Network Computing
2
// http://boinc.berkeley.edu
3
// Copyright (C) 2005 University of California
5
// This is free software; you can redistribute it and/or
6
// modify it under the terms of the GNU Lesser General Public
7
// License as published by the Free Software Foundation;
8
// either version 2.1 of the License, or (at your option) any later version.
10
// This software is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
// See the GNU Lesser General Public License for more details.
15
// To view the GNU Lesser General Public License visit
16
// http://www.gnu.org/copyleft/lesser.html
17
// or write to the Free Software Foundation, Inc.,
18
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
#if defined(__GNUG__) && !defined(__APPLE__)
22
#pragma implementation "AccountInfoPage.h"
26
#include "diagnostics.h"
31
#include "error_numbers.h"
33
#include "error_numbers.h"
34
#include "BOINCGUIApp.h"
35
#include "SkinManager.h"
36
#include "MainDocument.h"
37
#include "wx/valgen.h"
38
#include "wx/valtext.h"
39
#include "hyperlink.h"
40
#include "ValidateEmailAddress.h"
41
#include "BOINCWizards.h"
42
#include "BOINCBaseWizard.h"
43
#include "WizardAttachProject.h"
44
#include "WizardAccountManager.h"
45
#include "ProjectInfoPage.h"
46
#include "AccountManagerInfoPage.h"
47
#include "AccountInfoPage.h"
51
* CAccountInfoPage type definition
54
IMPLEMENT_DYNAMIC_CLASS( CAccountInfoPage, wxWizardPageEx )
57
* CAccountInfoPage event table definition
60
BEGIN_EVENT_TABLE( CAccountInfoPage, wxWizardPageEx )
62
////@begin CAccountInfoPage event table entries
63
EVT_WIZARDEX_PAGE_CHANGED( -1, CAccountInfoPage::OnPageChanged )
64
EVT_WIZARDEX_PAGE_CHANGING( -1, CAccountInfoPage::OnPageChanging )
65
EVT_WIZARDEX_CANCEL( -1, CAccountInfoPage::OnCancel )
66
EVT_RADIOBUTTON( ID_ACCOUNTCREATECTRL, CAccountInfoPage::OnAccountCreateCtrlSelected )
67
EVT_RADIOBUTTON( ID_ACCOUNTUSEEXISTINGCTRL, CAccountInfoPage::OnAccountUseExistingCtrlSelected )
68
////@end CAccountInfoPage event table entries
73
* CAccountInfoPage constructors
76
CAccountInfoPage::CAccountInfoPage( )
80
CAccountInfoPage::CAccountInfoPage( CBOINCBaseWizard* parent )
86
* AccountInfoPage creator
89
bool CAccountInfoPage::Create( CBOINCBaseWizard* parent )
92
////@begin CAccountInfoPage member initialisation
93
m_pTitleStaticCtrl = NULL;
94
m_pAccountQuestionStaticCtrl = NULL;
95
m_pAccountInformationStaticCtrl = NULL;
96
m_pAccountCreateCtrl = NULL;
97
m_pAccountUseExistingCtrl = NULL;
98
m_pAccountEmailAddressStaticCtrl = NULL;
99
m_pAccountEmailAddressCtrl = NULL;
100
m_pAccountPasswordStaticCtrl = NULL;
101
m_pAccountPasswordCtrl = NULL;
102
m_pAccountConfirmPasswordStaticCtrl = NULL;
103
m_pAccountConfirmPasswordCtrl = NULL;
104
m_pAccountPasswordRequirmentsStaticCtrl = NULL;
105
m_pAccountForgotPasswordCtrl = NULL;
106
////@end CAccountInfoPage member initialisation
108
////@begin CAccountInfoPage creation
109
wxBitmap wizardBitmap(wxNullBitmap);
110
wxWizardPageEx::Create( parent, ID_ACCOUNTINFOPAGE, wizardBitmap );
113
GetSizer()->Fit(this);
114
////@end CAccountInfoPage creation
120
* Control creation for AccountInfoPage
123
void CAccountInfoPage::CreateControls()
126
////@begin CAccountInfoPage content construction
127
CAccountInfoPage* itemWizardPage56 = this;
129
wxBoxSizer* itemBoxSizer57 = new wxBoxSizer(wxVERTICAL);
130
itemWizardPage56->SetSizer(itemBoxSizer57);
132
m_pTitleStaticCtrl = new wxStaticText;
133
m_pTitleStaticCtrl->Create( itemWizardPage56, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
134
m_pTitleStaticCtrl->SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, FALSE, _T("Verdana")));
135
itemBoxSizer57->Add(m_pTitleStaticCtrl, 0, wxALIGN_LEFT|wxGROW|wxALL, 5);
137
m_pAccountQuestionStaticCtrl = new wxStaticText;
138
m_pAccountQuestionStaticCtrl->Create( itemWizardPage56, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
139
itemBoxSizer57->Add(m_pAccountQuestionStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
141
wxFlexGridSizer* itemFlexGridSizer61 = new wxFlexGridSizer(1, 2, 0, 0);
142
itemFlexGridSizer61->AddGrowableCol(1);
143
itemBoxSizer57->Add(itemFlexGridSizer61, 0, wxGROW|wxALL, 5);
145
m_pAccountCreateCtrl = new wxRadioButton;
146
m_pAccountCreateCtrl->Create( itemWizardPage56, ID_ACCOUNTCREATECTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
147
m_pAccountCreateCtrl->SetValue(TRUE);
148
itemFlexGridSizer61->Add(m_pAccountCreateCtrl, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
150
m_pAccountUseExistingCtrl = new wxRadioButton;
151
m_pAccountUseExistingCtrl->Create( itemWizardPage56, ID_ACCOUNTUSEEXISTINGCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
152
m_pAccountUseExistingCtrl->SetValue(FALSE);
153
itemFlexGridSizer61->Add(m_pAccountUseExistingCtrl, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
155
m_pAccountInformationStaticCtrl = new wxStaticText;
156
m_pAccountInformationStaticCtrl->Create( itemWizardPage56, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
157
itemBoxSizer57->Add(m_pAccountInformationStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
159
wxFlexGridSizer* itemFlexGridSizer64 = new wxFlexGridSizer(4, 2, 0, 0);
160
itemFlexGridSizer64->AddGrowableCol(1);
161
itemBoxSizer57->Add(itemFlexGridSizer64, 0, wxEXPAND|wxALL, 0);
163
m_pAccountEmailAddressStaticCtrl = new wxStaticText;
164
m_pAccountEmailAddressStaticCtrl->Create( itemWizardPage56, ID_ACCOUNTEMAILADDRESSSTATICCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
165
itemFlexGridSizer64->Add(m_pAccountEmailAddressStaticCtrl, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
167
m_pAccountEmailAddressCtrl = new wxTextCtrl;
168
m_pAccountEmailAddressCtrl->Create( itemWizardPage56, ID_ACCOUNTEMAILADDRESSCTRL, wxEmptyString, wxDefaultPosition, wxSize(200, 22), 0 );
169
itemFlexGridSizer64->Add(m_pAccountEmailAddressCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5);
171
m_pAccountPasswordStaticCtrl = new wxStaticText;
172
m_pAccountPasswordStaticCtrl->Create( itemWizardPage56, ID_ACCOUNTPASSWORDSTATICCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
173
itemFlexGridSizer64->Add(m_pAccountPasswordStaticCtrl, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
175
m_pAccountPasswordCtrl = new wxTextCtrl;
176
m_pAccountPasswordCtrl->Create( itemWizardPage56, ID_ACCOUNTPASSWORDCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD );
177
itemFlexGridSizer64->Add(m_pAccountPasswordCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5);
179
m_pAccountConfirmPasswordStaticCtrl = new wxStaticText;
180
m_pAccountConfirmPasswordStaticCtrl->Create( itemWizardPage56, ID_ACCOUNTCONFIRMPASSWORDSTATICCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
181
itemFlexGridSizer64->Add(m_pAccountConfirmPasswordStaticCtrl, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
183
m_pAccountConfirmPasswordCtrl = new wxTextCtrl;
184
m_pAccountConfirmPasswordCtrl->Create( itemWizardPage56, ID_ACCOUNTCONFIRMPASSWORDCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD );
185
itemFlexGridSizer64->Add(m_pAccountConfirmPasswordCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5);
187
itemFlexGridSizer64->Add( 0, 0 );
189
m_pAccountPasswordRequirmentsStaticCtrl = new wxStaticText;
190
m_pAccountPasswordRequirmentsStaticCtrl->Create( itemWizardPage56, ID_ACCOUNTREQUIREMENTSSTATICCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
191
m_pAccountPasswordRequirmentsStaticCtrl->SetFont(wxFont(7, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE));
192
itemFlexGridSizer64->Add(m_pAccountPasswordRequirmentsStaticCtrl, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
194
m_pAccountForgotPasswordCtrl = new wxHyperLink;
195
m_pAccountForgotPasswordCtrl->Create( itemWizardPage56, ID_ACCOUNTFORGOTPASSWORDCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
196
itemFlexGridSizer64->Add(m_pAccountForgotPasswordCtrl, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
199
// m_pAccountEmailAddressCtrl is setup when the OnPageChange event is fired since
200
// it can be a username or an email address.
201
m_pAccountPasswordCtrl->SetValidator( wxTextValidator(wxFILTER_ASCII, &m_strAccountPassword) );
202
m_pAccountConfirmPasswordCtrl->SetValidator( wxTextValidator(wxFILTER_ASCII, &m_strAccountConfirmPassword) );
203
////@end CAccountInfoPage content construction
208
* Gets the previous page.
211
wxWizardPageEx* CAccountInfoPage::GetPrev() const
213
return PAGE_TRANSITION_BACK;
217
* Gets the next page.
220
wxWizardPageEx* CAccountInfoPage::GetNext() const
222
if (CHECK_CLOSINGINPROGRESS()) {
223
// Cancel Event Detected
224
return PAGE_TRANSITION_NEXT(ID_COMPLETIONERRORPAGE);
225
} else if (IS_ATTACHTOPROJECTWIZARD()) {
226
return PAGE_TRANSITION_NEXT(ID_PROJECTPROCESSINGPAGE);
227
} else if (IS_ACCOUNTMANAGERWIZARD()) {
228
return PAGE_TRANSITION_NEXT(ID_ACCOUNTMANAGERPROCESSINGPAGE);
234
* Should we show tooltips?
237
bool CAccountInfoPage::ShowToolTips()
243
* Get bitmap resources
246
wxBitmap CAccountInfoPage::GetBitmapResource( const wxString& WXUNUSED(name) )
249
////@begin CAccountInfoPage bitmap retrieval
251
////@end CAccountInfoPage bitmap retrieval
258
wxIcon CAccountInfoPage::GetIconResource( const wxString& WXUNUSED(name) )
261
////@begin CAccountInfoPage icon retrieval
263
////@end CAccountInfoPage icon retrieval
267
* wxEVT_WIZARD_PAGE_CHANGED event handler for ID_ACCOUNTINFOPAGE
270
void CAccountInfoPage::OnPageChanged( wxWizardExEvent& event ) {
271
if (event.GetDirection() == false) return;
273
PROJECT_CONFIG& pc = ((CBOINCBaseWizard*)GetParent())->project_config;
274
CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
275
CSkinWizardATAM* pSkinWizardATAM = wxGetApp().GetSkinManager()->GetWizards()->GetWizardATAM();
276
CWizardAttachProject* pWAP = ((CWizardAttachProject*)GetParent());
277
CWizardAccountManager* pWAM = ((CWizardAccountManager*)GetParent());
279
wxASSERT(pSkinAdvanced);
280
wxASSERT(pSkinWizardATAM);
281
wxASSERT(m_pTitleStaticCtrl);
282
wxASSERT(m_pAccountQuestionStaticCtrl);
283
wxASSERT(m_pAccountInformationStaticCtrl);
284
wxASSERT(m_pAccountCreateCtrl);
285
wxASSERT(m_pAccountUseExistingCtrl);
286
wxASSERT(m_pAccountEmailAddressStaticCtrl);
287
wxASSERT(m_pAccountEmailAddressCtrl);
288
wxASSERT(m_pAccountPasswordStaticCtrl);
289
wxASSERT(m_pAccountPasswordCtrl);
290
wxASSERT(m_pAccountConfirmPasswordStaticCtrl);
291
wxASSERT(m_pAccountConfirmPasswordCtrl);
292
wxASSERT(m_pAccountPasswordRequirmentsStaticCtrl);
293
wxASSERT(m_pAccountForgotPasswordCtrl);
294
wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));
295
wxASSERT(wxDynamicCast(pSkinWizardATAM, CSkinWizardATAM));
298
static bool bRunOnce = true;
301
if (!IS_ACCOUNTMANAGERWIZARD()) {
302
m_pAccountCreateCtrl->SetValue(true);
303
m_pAccountUseExistingCtrl->SetValue(false);
307
if (IS_ACCOUNTMANAGERWIZARD()) {
308
m_pAccountQuestionStaticCtrl->Hide();
309
m_pAccountCreateCtrl->SetValue(false);
310
m_pAccountCreateCtrl->Hide();
311
m_pAccountUseExistingCtrl->SetValue(true);
312
m_pAccountUseExistingCtrl->Hide();
313
m_pAccountConfirmPasswordStaticCtrl->Hide();
314
m_pAccountConfirmPasswordCtrl->Hide();
315
m_pAccountPasswordRequirmentsStaticCtrl->Hide();
318
if (!IS_ACCOUNTMANAGERWIZARD()) {
319
if (pc.account_creation_disabled || pc.client_account_creation_disabled) {
320
m_pAccountCreateCtrl->SetValue(false);
321
m_pAccountCreateCtrl->Hide();
322
m_pAccountUseExistingCtrl->SetValue(true);
323
m_pAccountUseExistingCtrl->Hide();
325
m_pAccountCreateCtrl->Show();
326
m_pAccountCreateCtrl->Enable();
327
m_pAccountUseExistingCtrl->Show();
331
m_pTitleStaticCtrl->SetLabel(
332
_("User information")
335
if (!IS_ACCOUNTMANAGERWIZARD() && !IS_ACCOUNTMANAGERUPDATEWIZARD()) {
336
if (pc.client_account_creation_disabled) {
337
m_pAccountQuestionStaticCtrl->SetLabel(
338
_("Please enter your account information\n(to create an account, visit the project's web site)")
340
} else if (pc.account_creation_disabled) {
341
m_pAccountQuestionStaticCtrl->SetLabel(
342
_("This project is not currently accepting new accounts.\nYou can attach only if you already have an account.")
345
m_pAccountQuestionStaticCtrl->SetLabel(
346
_("Are you already running this project?")
349
m_pAccountCreateCtrl->SetLabel(
352
m_pAccountUseExistingCtrl->SetLabel(
353
_("&Yes, existing user")
356
if (pSkinAdvanced->IsBranded() &&
357
!pSkinWizardATAM->GetAccountInfoMessage().IsEmpty()) {
358
m_pAccountInformationStaticCtrl->SetLabel(
359
pSkinWizardATAM->GetAccountInfoMessage()
364
if (m_pAccountUseExistingCtrl->GetValue()) {
365
m_pAccountConfirmPasswordStaticCtrl->Hide();
366
m_pAccountConfirmPasswordCtrl->Hide();
367
m_pAccountPasswordRequirmentsStaticCtrl->Hide();
368
m_pAccountPasswordStaticCtrl->SetLabel(
372
m_pAccountConfirmPasswordStaticCtrl->Show();
373
m_pAccountConfirmPasswordCtrl->Show();
374
m_pAccountPasswordRequirmentsStaticCtrl->Show();
375
m_pAccountPasswordStaticCtrl->SetLabel(
376
_("Choose a &password:")
378
m_pAccountConfirmPasswordStaticCtrl->SetLabel(
379
_("C&onfirm password:")
383
if (!((CBOINCBaseWizard*)GetParent())->project_name.IsEmpty()) {
384
wxString strQuestion;
386
_("Are you already running %s?"),
387
((CBOINCBaseWizard*)GetParent())->project_name.c_str()
389
m_pAccountQuestionStaticCtrl->SetLabel(strQuestion);
392
if (((CBOINCBaseWizard*)GetParent())->project_config.uses_username) {
393
if (IS_ACCOUNTMANAGERWIZARD()) {
394
if (pSkinAdvanced->IsBranded() &&
395
!pSkinWizardATAM->GetAccountInfoMessage().IsEmpty()) {
396
m_pAccountInformationStaticCtrl->SetLabel(
397
pSkinWizardATAM->GetAccountInfoMessage()
402
m_pAccountEmailAddressStaticCtrl->SetLabel(
405
m_pAccountEmailAddressCtrl->SetValidator( wxTextValidator(wxFILTER_ASCII, &m_strAccountEmailAddress) );
407
if (IS_ACCOUNTMANAGERWIZARD()) {
408
if (pSkinAdvanced->IsBranded() &&
409
!pSkinWizardATAM->GetAccountInfoMessage().IsEmpty()) {
410
m_pAccountInformationStaticCtrl->SetLabel(
411
pSkinWizardATAM->GetAccountInfoMessage()
416
m_pAccountEmailAddressStaticCtrl->SetLabel(
419
m_pAccountEmailAddressCtrl->SetValidator( CValidateEmailAddress(& m_strAccountEmailAddress) );
422
if (pc.min_passwd_length) {
424
str.Printf(_("minimum length %d"), pc.min_passwd_length);
425
m_pAccountPasswordRequirmentsStaticCtrl->SetLabel( str );
428
m_pAccountForgotPasswordCtrl->SetLabel(
429
_("Forgot your password?")
432
if (!IS_ACCOUNTMANAGERWIZARD()) {
434
m_pAccountForgotPasswordCtrl->SetURL(
435
wxString(pWAP->m_ProjectInfoPage->GetProjectURL() + _T("get_passwd.php"))
439
m_pAccountForgotPasswordCtrl->SetURL(
440
wxString(pWAM->m_AccountManagerInfoPage->GetProjectURL() + _T("get_passwd.php"))
445
m_pAccountEmailAddressCtrl->SetFocus();
449
* wxEVT_WIZARD_PAGE_CHANGING event handler for ID_ACCOUNTINFOPAGE
452
void CAccountInfoPage::OnPageChanging( wxWizardExEvent& event )
454
if (event.GetDirection() == false) return;
456
if (!CHECK_CLOSINGINPROGRESS()) {
458
if (IS_ATTACHTOPROJECTWIZARD()) {
459
strTitle = _("Attach to project");
460
} else if (IS_ACCOUNTMANAGERWIZARD() && IS_ACCOUNTMANAGERUPDATEWIZARD()) {
461
strTitle = _("Update account manager");
462
} else if (IS_ACCOUNTMANAGERWIZARD()) {
463
strTitle = _("Attach to account manager");
465
wxString strMessage = wxT("");
466
bool bDisplayError = false;
468
// Verify minimum password length
469
unsigned int iMinLength = ((CBOINCBaseWizard*)GetParent())->project_config.min_passwd_length;
470
wxString strPassword = m_pAccountPasswordCtrl->GetValue();
471
if (strPassword.Length() < iMinLength) {
472
if (IS_ATTACHTOPROJECTWIZARD()) {
474
_("The minimum password length for this project is %d. Please enter a different password."),
478
if (IS_ACCOUNTMANAGERWIZARD()) {
480
_("The minimum password length for this account manager is %d. Please enter a different password."),
485
bDisplayError = true;
488
if (!IS_ACCOUNTMANAGERWIZARD() && m_pAccountCreateCtrl->GetValue()) {
489
// Verify that the password and confirmation password math.
490
if (m_pAccountPasswordCtrl->GetValue() != m_pAccountConfirmPasswordCtrl->GetValue()) {
491
strMessage = _("The password and confirmation password do not match. Please type them again.");
492
bDisplayError = true;
509
* wxEVT_WIZARD_CANCEL event handler for ID_ACCOUNTINFOPAGE
512
void CAccountInfoPage::OnCancel( wxWizardExEvent& event ) {
513
PROCESS_CANCELEVENT(event);
517
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_ACCOUNTUSEXISTINGBUTTON
520
void CAccountInfoPage::OnAccountUseExistingCtrlSelected( wxCommandEvent& WXUNUSED(event) ) {
521
m_pAccountPasswordStaticCtrl->SetLabel(
524
m_pAccountConfirmPasswordStaticCtrl->Hide();
525
m_pAccountConfirmPasswordCtrl->Hide();
526
m_pAccountPasswordRequirmentsStaticCtrl->Hide();
527
m_pAccountEmailAddressCtrl->SetFocus();
532
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_ACCOUNTCREATEBUTTON
535
void CAccountInfoPage::OnAccountCreateCtrlSelected( wxCommandEvent& WXUNUSED(event) ) {
536
m_pAccountPasswordStaticCtrl->SetLabel(
537
_("Choose a &password:")
539
m_pAccountConfirmPasswordStaticCtrl->Show();
540
m_pAccountConfirmPasswordCtrl->Show();
541
m_pAccountPasswordRequirmentsStaticCtrl->Show();
542
m_pAccountEmailAddressCtrl->SetFocus();
1
// This file is part of BOINC.
2
// http://boinc.berkeley.edu
3
// Copyright (C) 2008 University of California
5
// BOINC is free software; you can redistribute it and/or modify it
6
// under the terms of the GNU Lesser General Public License
7
// as published by the Free Software Foundation,
8
// either version 3 of the License, or (at your option) any later version.
10
// BOINC is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
// See the GNU Lesser General Public License for more details.
15
// You should have received a copy of the GNU Lesser General Public License
16
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
18
#if defined(__GNUG__) && !defined(__APPLE__)
19
#pragma implementation "AccountInfoPage.h"
23
#include "diagnostics.h"
28
#include "error_numbers.h"
30
#include "error_numbers.h"
31
#include "BOINCGUIApp.h"
32
#include "SkinManager.h"
33
#include "MainDocument.h"
34
#include "wx/valgen.h"
35
#include "wx/valtext.h"
36
#include "ValidateEmailAddress.h"
37
#include "BOINCBaseWizard.h"
38
#include "WizardAttach.h"
39
#include "ProjectInfoPage.h"
40
#include "AccountManagerInfoPage.h"
41
#include "AccountInfoPage.h"
45
* CAccountInfoPage type definition
48
IMPLEMENT_DYNAMIC_CLASS( CAccountInfoPage, wxWizardPageEx )
51
* CAccountInfoPage event table definition
54
BEGIN_EVENT_TABLE( CAccountInfoPage, wxWizardPageEx )
56
////@begin CAccountInfoPage event table entries
57
EVT_WIZARDEX_PAGE_CHANGED( -1, CAccountInfoPage::OnPageChanged )
58
EVT_WIZARDEX_PAGE_CHANGING( -1, CAccountInfoPage::OnPageChanging )
59
EVT_WIZARDEX_CANCEL( -1, CAccountInfoPage::OnCancel )
60
EVT_RADIOBUTTON( ID_ACCOUNTCREATECTRL, CAccountInfoPage::OnAccountCreateCtrlSelected )
61
EVT_RADIOBUTTON( ID_ACCOUNTUSEEXISTINGCTRL, CAccountInfoPage::OnAccountUseExistingCtrlSelected )
62
////@end CAccountInfoPage event table entries
67
* CAccountInfoPage constructors
70
CAccountInfoPage::CAccountInfoPage( )
74
CAccountInfoPage::CAccountInfoPage( CBOINCBaseWizard* parent )
80
* AccountInfoPage creator
83
bool CAccountInfoPage::Create( CBOINCBaseWizard* parent )
86
////@begin CAccountInfoPage member initialisation
87
m_pTitleStaticCtrl = NULL;
88
m_pCookieDetectionFailedStaticCtrl = NULL;
89
m_pCookieDetectionFailedCtrl = NULL;
90
m_pAccountQuestionStaticCtrl = NULL;
91
m_pAccountInformationStaticCtrl = NULL;
92
m_pAccountCreateCtrl = NULL;
93
m_pAccountUseExistingCtrl = NULL;
94
m_pAccountEmailAddressStaticCtrl = NULL;
95
m_pAccountEmailAddressCtrl = NULL;
96
m_pAccountPasswordStaticCtrl = NULL;
97
m_pAccountPasswordCtrl = NULL;
98
m_pAccountConfirmPasswordStaticCtrl = NULL;
99
m_pAccountConfirmPasswordCtrl = NULL;
100
m_pAccountPasswordRequirmentsStaticCtrl = NULL;
101
m_pAccountManagerLinkLabelStaticCtrl = NULL;
102
m_pAccountForgotPasswordCtrl = NULL;
103
////@end CAccountInfoPage member initialisation
105
////@begin CAccountInfoPage creation
106
wxWizardPageEx::Create( parent, ID_ACCOUNTINFOPAGE );
109
GetSizer()->Fit(this);
110
////@end CAccountInfoPage creation
116
* Control creation for AccountInfoPage
119
void CAccountInfoPage::CreateControls()
122
////@begin CAccountInfoPage content construction
123
CAccountInfoPage* itemWizardPage56 = this;
125
wxBoxSizer* itemBoxSizer57 = new wxBoxSizer(wxVERTICAL);
126
itemWizardPage56->SetSizer(itemBoxSizer57);
128
m_pTitleStaticCtrl = new wxStaticText;
129
m_pTitleStaticCtrl->Create( itemWizardPage56, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
130
m_pTitleStaticCtrl->SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, FALSE, _T("Verdana")));
131
itemBoxSizer57->Add(m_pTitleStaticCtrl, 0, wxALIGN_LEFT|wxGROW|wxALL, 5);
133
m_pCookieDetectionFailedStaticCtrl = new wxStaticText;
134
m_pCookieDetectionFailedStaticCtrl->Create( itemWizardPage56, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
135
m_pCookieDetectionFailedStaticCtrl->Hide();
136
itemBoxSizer57->Add(m_pCookieDetectionFailedStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
138
m_pCookieDetectionFailedCtrl = new wxHyperlinkCtrl;
139
m_pCookieDetectionFailedCtrl->Create( itemWizardPage56, ID_ACCOUNTCOOKIEDETECTIONFAILEDCTRL, wxT(" "), wxT(" "), wxDefaultPosition, wxDefaultSize, wxNO_BORDER | wxHL_ALIGN_LEFT | wxHL_CONTEXTMENU );
140
m_pCookieDetectionFailedCtrl->Hide();
141
itemBoxSizer57->Add(m_pCookieDetectionFailedCtrl, 0, wxALIGN_LEFT|wxALL, 5);
143
m_pAccountQuestionStaticCtrl = new wxStaticText;
144
m_pAccountQuestionStaticCtrl->Create( itemWizardPage56, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
145
itemBoxSizer57->Add(m_pAccountQuestionStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
147
wxFlexGridSizer* itemFlexGridSizer61 = new wxFlexGridSizer(1, 2, 0, 0);
148
itemFlexGridSizer61->AddGrowableCol(1);
149
itemBoxSizer57->Add(itemFlexGridSizer61, 0, wxGROW|wxALL, 5);
151
m_pAccountCreateCtrl = new wxRadioButton;
152
m_pAccountCreateCtrl->Create( itemWizardPage56, ID_ACCOUNTCREATECTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
153
m_pAccountCreateCtrl->SetValue(TRUE);
154
itemFlexGridSizer61->Add(m_pAccountCreateCtrl, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
156
m_pAccountUseExistingCtrl = new wxRadioButton;
157
m_pAccountUseExistingCtrl->Create( itemWizardPage56, ID_ACCOUNTUSEEXISTINGCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
158
m_pAccountUseExistingCtrl->SetValue(FALSE);
159
itemFlexGridSizer61->Add(m_pAccountUseExistingCtrl, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
161
m_pAccountInformationStaticCtrl = new wxStaticText;
162
m_pAccountInformationStaticCtrl->Create( itemWizardPage56, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
163
itemBoxSizer57->Add(m_pAccountInformationStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
165
wxFlexGridSizer* itemFlexGridSizer64 = new wxFlexGridSizer(4, 2, 0, 0);
166
itemFlexGridSizer64->AddGrowableCol(1);
167
itemBoxSizer57->Add(itemFlexGridSizer64, 0, wxEXPAND|wxALL, 0);
169
m_pAccountEmailAddressStaticCtrl = new wxStaticText;
170
m_pAccountEmailAddressStaticCtrl->Create( itemWizardPage56, ID_ACCOUNTEMAILADDRESSSTATICCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
171
itemFlexGridSizer64->Add(m_pAccountEmailAddressStaticCtrl, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
173
m_pAccountEmailAddressCtrl = new wxTextCtrl;
174
m_pAccountEmailAddressCtrl->Create( itemWizardPage56, ID_ACCOUNTEMAILADDRESSCTRL, wxEmptyString, wxDefaultPosition, wxSize(200, 22), 0 );
175
itemFlexGridSizer64->Add(m_pAccountEmailAddressCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5);
177
m_pAccountUsernameStaticCtrl = new wxStaticText;
178
m_pAccountUsernameStaticCtrl->Create( itemWizardPage56, ID_ACCOUNTUSERNAMESTATICCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
179
itemFlexGridSizer64->Add(m_pAccountUsernameStaticCtrl, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
181
m_pAccountUsernameCtrl = new wxTextCtrl;
182
m_pAccountUsernameCtrl->Create( itemWizardPage56, ID_ACCOUNTUSERNAMECTRL, wxEmptyString, wxDefaultPosition, wxSize(200, 22), 0 );
183
itemFlexGridSizer64->Add(m_pAccountUsernameCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5);
185
m_pAccountPasswordStaticCtrl = new wxStaticText;
186
m_pAccountPasswordStaticCtrl->Create( itemWizardPage56, ID_ACCOUNTPASSWORDSTATICCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
187
itemFlexGridSizer64->Add(m_pAccountPasswordStaticCtrl, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
189
m_pAccountPasswordCtrl = new wxTextCtrl;
190
m_pAccountPasswordCtrl->Create( itemWizardPage56, ID_ACCOUNTPASSWORDCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD );
191
itemFlexGridSizer64->Add(m_pAccountPasswordCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5);
193
m_pAccountConfirmPasswordStaticCtrl = new wxStaticText;
194
m_pAccountConfirmPasswordStaticCtrl->Create( itemWizardPage56, ID_ACCOUNTCONFIRMPASSWORDSTATICCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
195
itemFlexGridSizer64->Add(m_pAccountConfirmPasswordStaticCtrl, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
197
m_pAccountConfirmPasswordCtrl = new wxTextCtrl;
198
m_pAccountConfirmPasswordCtrl->Create( itemWizardPage56, ID_ACCOUNTCONFIRMPASSWORDCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD );
199
itemFlexGridSizer64->Add(m_pAccountConfirmPasswordCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5);
201
itemFlexGridSizer64->Add( 0, 0 );
203
m_pAccountPasswordRequirmentsStaticCtrl = new wxStaticText;
204
m_pAccountPasswordRequirmentsStaticCtrl->Create( itemWizardPage56, ID_ACCOUNTREQUIREMENTSSTATICCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
205
m_pAccountPasswordRequirmentsStaticCtrl->SetFont(wxFont(7, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE));
206
itemFlexGridSizer64->Add(m_pAccountPasswordRequirmentsStaticCtrl, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
208
m_pAccountManagerLinkLabelStaticCtrl = new wxStaticText;
209
m_pAccountManagerLinkLabelStaticCtrl->Create( itemWizardPage56, ID_ACCOUNTLINKLABELSTATICCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
210
itemBoxSizer57->Add(m_pAccountManagerLinkLabelStaticCtrl, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
212
m_pAccountForgotPasswordCtrl = new wxHyperlinkCtrl;
213
m_pAccountForgotPasswordCtrl->Create( itemWizardPage56, ID_ACCOUNTFORGOTPASSWORDCTRL, wxT(" "), wxT(" "), wxDefaultPosition, wxDefaultSize, wxNO_BORDER | wxHL_ALIGN_LEFT | wxHL_CONTEXTMENU );
214
itemBoxSizer57->Add(m_pAccountForgotPasswordCtrl, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
217
// m_pAccountEmailAddressCtrl/m_pAccountUsernameCtrl is setup when the OnPageChange event is fired since
218
// it can be a username or an email address.
219
m_pAccountEmailAddressCtrl->SetValidator( wxTextValidator(wxFILTER_NONE, &m_strAccountEmailAddress) );
220
m_pAccountUsernameCtrl->SetValidator( wxTextValidator(wxFILTER_NONE, &m_strAccountUsername) );
221
m_pAccountPasswordCtrl->SetValidator( wxTextValidator(wxFILTER_NONE, &m_strAccountPassword) );
222
m_pAccountConfirmPasswordCtrl->SetValidator( wxTextValidator(wxFILTER_NONE, &m_strAccountConfirmPassword) );
226
HIViewRef buttonView = (HIViewRef)m_pAccountCreateCtrl->GetHandle();
227
HIObjectRef theObject = (HIObjectRef)HIViewGetSuperview(buttonView);
228
HIObjectSetAccessibilityIgnored(theObject, true);
230
////@end CAccountInfoPage content construction
235
* Gets the previous page.
238
wxWizardPageEx* CAccountInfoPage::GetPrev() const
240
return PAGE_TRANSITION_BACK;
244
* Gets the next page.
247
wxWizardPageEx* CAccountInfoPage::GetNext() const
249
if (CHECK_CLOSINGINPROGRESS()) {
250
// Cancel Event Detected
251
return PAGE_TRANSITION_NEXT(ID_COMPLETIONERRORPAGE);
252
} else if (IS_ATTACHTOPROJECTWIZARD()) {
253
return PAGE_TRANSITION_NEXT(ID_PROJECTPROCESSINGPAGE);
254
} else if (IS_ACCOUNTMANAGERWIZARD()) {
255
return PAGE_TRANSITION_NEXT(ID_ACCOUNTMANAGERPROCESSINGPAGE);
261
* Should we show tooltips?
264
bool CAccountInfoPage::ShowToolTips()
270
* Get bitmap resources
273
wxBitmap CAccountInfoPage::GetBitmapResource( const wxString& WXUNUSED(name) )
276
////@begin CAccountInfoPage bitmap retrieval
278
////@end CAccountInfoPage bitmap retrieval
285
wxIcon CAccountInfoPage::GetIconResource( const wxString& WXUNUSED(name) )
288
////@begin CAccountInfoPage icon retrieval
290
////@end CAccountInfoPage icon retrieval
294
* wxEVT_WIZARD_PAGE_CHANGED event handler for ID_ACCOUNTINFOPAGE
297
void CAccountInfoPage::OnPageChanged( wxWizardExEvent& event ) {
298
if (event.GetDirection() == false) return;
300
CWizardAttach* pWA = ((CWizardAttach*)GetParent());
301
CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
302
CSkinWizardATAM* pSkinWizardATAM = wxGetApp().GetSkinManager()->GetWizards()->GetWizardATAM();
303
PROJECT_CONFIG& pc = pWA->project_config;
304
wxString strBaseConfigLocation = wxString(wxT("/Wizards"));
305
wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
307
wxASSERT(pSkinAdvanced);
308
wxASSERT(pSkinWizardATAM);
309
wxASSERT(m_pTitleStaticCtrl);
310
wxASSERT(m_pCookieDetectionFailedStaticCtrl);
311
wxASSERT(m_pCookieDetectionFailedCtrl);
312
wxASSERT(m_pAccountQuestionStaticCtrl);
313
wxASSERT(m_pAccountInformationStaticCtrl);
314
wxASSERT(m_pAccountCreateCtrl);
315
wxASSERT(m_pAccountUseExistingCtrl);
316
wxASSERT(m_pAccountEmailAddressStaticCtrl);
317
wxASSERT(m_pAccountEmailAddressCtrl);
318
wxASSERT(m_pAccountUsernameStaticCtrl);
319
wxASSERT(m_pAccountUsernameCtrl);
320
wxASSERT(m_pAccountPasswordStaticCtrl);
321
wxASSERT(m_pAccountPasswordCtrl);
322
wxASSERT(m_pAccountConfirmPasswordStaticCtrl);
323
wxASSERT(m_pAccountConfirmPasswordCtrl);
324
wxASSERT(m_pAccountPasswordRequirmentsStaticCtrl);
325
wxASSERT(m_pAccountManagerLinkLabelStaticCtrl);
326
wxASSERT(m_pAccountForgotPasswordCtrl);
327
wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));
328
wxASSERT(wxDynamicCast(pSkinWizardATAM, CSkinWizardATAM));
331
// We are entering this page, so reterieve the previously used email
332
// address and/or username.
333
pConfig->SetPath(strBaseConfigLocation);
334
m_strAccountEmailAddress = pConfig->Read(wxT("DefaultEmailAddress"));
335
m_strAccountUsername = pConfig->Read(wxT("DefaultUsername"));
337
// Setup the desired controls and default values.
338
static bool bRunOnce = true;
341
if (!IS_ACCOUNTMANAGERWIZARD()) {
342
m_pAccountCreateCtrl->SetValue(true);
343
m_pAccountUseExistingCtrl->SetValue(false);
347
if (IS_ACCOUNTMANAGERWIZARD()) {
348
if (!(pWA->m_bCookieRequired && !pWA->m_bCredentialsDetected)) {
349
m_pCookieDetectionFailedStaticCtrl->Hide();
350
m_pCookieDetectionFailedCtrl->Hide();
352
m_pCookieDetectionFailedStaticCtrl->Show();
353
m_pCookieDetectionFailedCtrl->Show();
356
m_pAccountQuestionStaticCtrl->Hide();
357
m_pAccountCreateCtrl->SetValue(false);
358
m_pAccountCreateCtrl->Hide();
359
m_pAccountUseExistingCtrl->SetValue(true);
360
m_pAccountUseExistingCtrl->Hide();
361
m_pAccountConfirmPasswordStaticCtrl->Hide();
362
m_pAccountConfirmPasswordCtrl->Hide();
363
m_pAccountPasswordRequirmentsStaticCtrl->Hide();
365
if (pWA->m_bCookieRequired && !pWA->m_bCredentialsDetected) {
366
m_pAccountManagerLinkLabelStaticCtrl->Hide();
367
m_pAccountForgotPasswordCtrl->Hide();
370
m_pCookieDetectionFailedStaticCtrl->Hide();
371
m_pCookieDetectionFailedCtrl->Hide();
372
if (pc.account_creation_disabled || pc.client_account_creation_disabled) {
373
m_pAccountCreateCtrl->SetValue(false);
374
m_pAccountCreateCtrl->Hide();
375
m_pAccountUseExistingCtrl->SetValue(true);
376
m_pAccountUseExistingCtrl->Hide();
378
m_pAccountCreateCtrl->Show();
379
m_pAccountCreateCtrl->Enable();
380
m_pAccountUseExistingCtrl->Show();
382
m_pAccountManagerLinkLabelStaticCtrl->Hide();
385
m_pTitleStaticCtrl->SetLabel(
386
_("Identify your account ")
389
if (!IS_ACCOUNTMANAGERWIZARD() && !IS_ACCOUNTMANAGERUPDATEWIZARD()) {
390
if (pc.client_account_creation_disabled) {
391
m_pAccountQuestionStaticCtrl->SetLabel(
392
_("Please enter your account information\n(to create an account, visit the project's web site)")
394
} else if (pc.account_creation_disabled) {
395
m_pAccountQuestionStaticCtrl->SetLabel(
396
_("This project is not currently accepting new accounts.\nYou can add it only if you already have an account.")
399
m_pAccountQuestionStaticCtrl->SetLabel(
400
_("Are you already running this project?")
403
m_pAccountCreateCtrl->SetLabel(
406
m_pAccountUseExistingCtrl->SetLabel(
407
_("&Yes, existing user")
410
if (pWA->m_bCookieRequired && !pWA->m_bCredentialsDetected) {
411
m_pCookieDetectionFailedStaticCtrl->SetLabel(
412
_("We were not able to set up your account information\nautomatically.\n\nPlease click on the 'Find login information' link\nbelow to find out what to put in the email address and\npassword fields.")
414
m_pCookieDetectionFailedCtrl->SetLabel(
415
_("Find login information")
417
m_pCookieDetectionFailedCtrl->SetURL(
418
pWA->m_strCookieFailureURL
422
if (pSkinAdvanced->IsBranded() &&
423
!pSkinWizardATAM->GetAccountInfoMessage().IsEmpty()) {
424
m_pAccountInformationStaticCtrl->SetLabel(
425
pSkinWizardATAM->GetAccountInfoMessage()
430
if (m_pAccountUseExistingCtrl->GetValue()) {
431
m_pAccountConfirmPasswordStaticCtrl->Hide();
432
m_pAccountConfirmPasswordCtrl->Hide();
433
m_pAccountPasswordRequirmentsStaticCtrl->Hide();
434
m_pAccountPasswordStaticCtrl->SetLabel(
438
m_pAccountConfirmPasswordStaticCtrl->Show();
439
m_pAccountConfirmPasswordCtrl->Show();
440
m_pAccountPasswordRequirmentsStaticCtrl->Show();
441
m_pAccountPasswordStaticCtrl->SetLabel(
442
_("Choose a &password:")
444
m_pAccountConfirmPasswordStaticCtrl->SetLabel(
445
_("C&onfirm password:")
449
if (!pWA->GetProjectName().IsEmpty()) {
450
wxString strQuestion;
452
_("Are you already running %s?"),
453
pWA->GetProjectName().c_str()
455
m_pAccountQuestionStaticCtrl->SetLabel(strQuestion);
458
if (pc.uses_username) {
459
if (IS_ACCOUNTMANAGERWIZARD()) {
460
if (pSkinAdvanced->IsBranded() &&
461
!pSkinWizardATAM->GetAccountInfoMessage().IsEmpty()) {
462
m_pAccountInformationStaticCtrl->SetLabel(
463
pSkinWizardATAM->GetAccountInfoMessage()
468
m_pAccountEmailAddressCtrl->SetValidator(
469
wxTextValidator(wxFILTER_NONE, &m_strAccountEmailAddress)
471
m_pAccountUsernameCtrl->SetValidator(
472
wxTextValidator(wxFILTER_ASCII, &m_strAccountUsername)
475
m_pAccountEmailAddressStaticCtrl->Hide();
476
m_pAccountEmailAddressCtrl->Hide();
477
m_pAccountUsernameStaticCtrl->Show();
478
m_pAccountUsernameCtrl->Show();
480
m_pAccountUsernameStaticCtrl->SetLabel(
483
m_pAccountUsernameCtrl->SetValue(m_strAccountUsername);
485
if (IS_ACCOUNTMANAGERWIZARD()) {
486
if (pSkinAdvanced->IsBranded() &&
487
!pSkinWizardATAM->GetAccountInfoMessage().IsEmpty()) {
488
m_pAccountInformationStaticCtrl->SetLabel(
489
pSkinWizardATAM->GetAccountInfoMessage()
494
m_pAccountEmailAddressCtrl->SetValidator(
495
CValidateEmailAddress(&m_strAccountEmailAddress)
497
m_pAccountUsernameCtrl->SetValidator(
498
wxTextValidator(wxFILTER_NONE, &m_strAccountUsername)
501
m_pAccountEmailAddressStaticCtrl->Show();
502
m_pAccountEmailAddressCtrl->Show();
503
m_pAccountUsernameStaticCtrl->Hide();
504
m_pAccountUsernameCtrl->Hide();
506
m_pAccountEmailAddressStaticCtrl->SetLabel(
509
m_pAccountEmailAddressCtrl->SetValue(m_strAccountEmailAddress);
512
if (pc.min_passwd_length) {
514
str.Printf(_("minimum length %d"), pc.min_passwd_length);
515
m_pAccountPasswordRequirmentsStaticCtrl->SetLabel( str );
519
if (!IS_ACCOUNTMANAGERWIZARD()) {
520
m_pAccountForgotPasswordCtrl->SetLabel(
521
_("Forgot your password?")
523
m_pAccountForgotPasswordCtrl->SetURL(
524
wxString(pWA->m_ProjectInfoPage->GetProjectURL() + _T("get_passwd.php"))
527
m_pAccountManagerLinkLabelStaticCtrl->SetLabel(
528
_("If you have not yet registered with this account manager,\nplease do so before proceeding. Click on the link below\nto register or to retrieve a forgotten password." )
530
m_pAccountForgotPasswordCtrl->SetLabel(
531
_("Account manager website")
533
m_pAccountForgotPasswordCtrl->SetURL(
534
wxString(pWA->m_AccountManagerInfoPage->GetProjectURL())
538
if (pc.uses_username) {
539
m_pAccountUsernameCtrl->SetFocus();
541
m_pAccountEmailAddressCtrl->SetFocus();
548
* wxEVT_WIZARD_PAGE_CHANGING event handler for ID_ACCOUNTINFOPAGE
551
void CAccountInfoPage::OnPageChanging( wxWizardExEvent& event ) {
552
if (event.GetDirection() == false) return;
554
CWizardAttach* pWA = ((CWizardAttach*)GetParent());
555
PROJECT_CONFIG& pc = pWA->project_config;
557
wxString strMessage = wxT("");
558
bool bDisplayError = false;
559
wxString strBaseConfigLocation = wxString(wxT("/Wizards"));
560
wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
562
if (!CHECK_CLOSINGINPROGRESS()) {
563
// We are leaving this page, so store the email address for future
565
pConfig->SetPath(strBaseConfigLocation);
566
pConfig->Write(wxT("DefaultEmailAddress"), m_strAccountEmailAddress);
567
pConfig->Write(wxT("DefaultUsername"), m_strAccountUsername);
569
// Construct potiental dialog title
570
if (IS_ATTACHTOPROJECTWIZARD()) {
571
strTitle = _("Add project");
572
} else if (IS_ACCOUNTMANAGERWIZARD() && IS_ACCOUNTMANAGERUPDATEWIZARD()) {
573
strTitle = _("Update account manager");
574
} else if (IS_ACCOUNTMANAGERWIZARD()) {
575
strTitle = _("Add account manager");
578
// Verify minimum password length
579
if (!m_pAccountUseExistingCtrl->GetValue()) {
580
if (m_pAccountPasswordCtrl->GetValue().Length() < (size_t)pc.min_passwd_length) {
581
if (IS_ATTACHTOPROJECTWIZARD()) {
583
_("The minimum password length for this project is %d. Please enter a different password."),
587
if (IS_ACCOUNTMANAGERWIZARD()) {
589
_("The minimum password length for this account manager is %d. Please enter a different password."),
594
bDisplayError = true;
598
// Verify that the password and confirmation password math.
599
if (!IS_ACCOUNTMANAGERWIZARD() && m_pAccountCreateCtrl->GetValue()) {
600
if (m_pAccountPasswordCtrl->GetValue() != m_pAccountConfirmPasswordCtrl->GetValue()) {
601
strMessage = _("The password and confirmation password do not match. Please type them again.");
602
bDisplayError = true;
607
wxGetApp().SafeMessageBox(
619
* wxEVT_WIZARD_CANCEL event handler for ID_ACCOUNTINFOPAGE
622
void CAccountInfoPage::OnCancel( wxWizardExEvent& event ) {
623
PROCESS_CANCELEVENT(event);
627
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_ACCOUNTUSEXISTINGBUTTON
630
void CAccountInfoPage::OnAccountUseExistingCtrlSelected( wxCommandEvent& WXUNUSED(event) ) {
631
CWizardAttach* pWA = ((CWizardAttach*)GetParent());
632
PROJECT_CONFIG& pc = pWA->project_config;
634
m_pAccountPasswordStaticCtrl->SetLabel(
637
m_pAccountConfirmPasswordStaticCtrl->Hide();
638
m_pAccountConfirmPasswordCtrl->Hide();
639
m_pAccountPasswordRequirmentsStaticCtrl->Hide();
641
if (pc.uses_username) {
642
m_pAccountUsernameCtrl->SetFocus();
644
m_pAccountEmailAddressCtrl->SetFocus();
651
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_ACCOUNTCREATEBUTTON
654
void CAccountInfoPage::OnAccountCreateCtrlSelected( wxCommandEvent& WXUNUSED(event) ) {
655
CWizardAttach* pWA = ((CWizardAttach*)GetParent());
656
PROJECT_CONFIG& pc = pWA->project_config;
658
m_pAccountPasswordStaticCtrl->SetLabel(
659
_("Choose a &password:")
661
m_pAccountConfirmPasswordStaticCtrl->Show();
662
m_pAccountConfirmPasswordCtrl->Show();
663
m_pAccountPasswordRequirmentsStaticCtrl->Show();
665
if (pc.uses_username) {
666
m_pAccountUsernameCtrl->SetFocus();
668
m_pAccountEmailAddressCtrl->SetFocus();