2008-08-06 18:36:30 +00:00
// This file is part of BOINC.
2005-09-26 11:29:28 +00:00
// http://boinc.berkeley.edu
2008-08-06 18:36:30 +00:00
// Copyright (C) 2008 University of California
2005-09-26 11:29:28 +00:00
//
2008-08-06 18:36:30 +00:00
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
2005-09-26 11:29:28 +00:00
//
2008-08-06 18:36:30 +00:00
// BOINC is distributed in the hope that it will be useful,
2005-09-26 11:29:28 +00:00
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
2008-08-06 18:36:30 +00:00
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
2005-09-26 11:29:28 +00:00
# if defined(__GNUG__) && !defined(__APPLE__)
# pragma implementation "AccountInfoPage.h"
# endif
# include "stdwx.h"
2006-10-20 15:00:14 +00:00
# include "diagnostics.h"
# include "util.h"
# include "mfile.h"
# include "miofile.h"
# include "parse.h"
# include "error_numbers.h"
2005-09-26 11:29:28 +00:00
# include "wizardex.h"
# include "error_numbers.h"
# include "BOINCGUIApp.h"
2006-10-20 15:00:14 +00:00
# include "SkinManager.h"
# include "MainDocument.h"
2005-09-26 11:29:28 +00:00
# include "wx/valgen.h"
2005-10-07 23:00:36 +00:00
# include "wx/valtext.h"
2008-01-14 19:30:19 +00:00
# include "hyperlink.h"
2006-01-24 11:27:26 +00:00
# include "ValidateEmailAddress.h"
2005-09-26 11:29:28 +00:00
# include "BOINCWizards.h"
# include "BOINCBaseWizard.h"
2008-01-14 19:30:19 +00:00
# include "WizardAttachProject.h"
# include "ProjectInfoPage.h"
# include "AccountManagerInfoPage.h"
2005-09-26 11:29:28 +00:00
# include "AccountInfoPage.h"
/*!
* CAccountInfoPage type definition
*/
IMPLEMENT_DYNAMIC_CLASS ( CAccountInfoPage , wxWizardPageEx )
/*!
* CAccountInfoPage event table definition
*/
BEGIN_EVENT_TABLE ( CAccountInfoPage , wxWizardPageEx )
////@begin CAccountInfoPage event table entries
EVT_WIZARDEX_PAGE_CHANGED ( - 1 , CAccountInfoPage : : OnPageChanged )
EVT_WIZARDEX_PAGE_CHANGING ( - 1 , CAccountInfoPage : : OnPageChanging )
EVT_WIZARDEX_CANCEL ( - 1 , CAccountInfoPage : : OnCancel )
EVT_RADIOBUTTON ( ID_ACCOUNTCREATECTRL , CAccountInfoPage : : OnAccountCreateCtrlSelected )
EVT_RADIOBUTTON ( ID_ACCOUNTUSEEXISTINGCTRL , CAccountInfoPage : : OnAccountUseExistingCtrlSelected )
////@end CAccountInfoPage event table entries
END_EVENT_TABLE ( )
/*!
* CAccountInfoPage constructors
*/
CAccountInfoPage : : CAccountInfoPage ( )
{
}
CAccountInfoPage : : CAccountInfoPage ( CBOINCBaseWizard * parent )
{
Create ( parent ) ;
}
/*!
* AccountInfoPage creator
*/
bool CAccountInfoPage : : Create ( CBOINCBaseWizard * parent )
{
////@begin CAccountInfoPage member initialisation
2006-01-27 00:34:53 +00:00
m_pTitleStaticCtrl = NULL ;
2009-06-12 21:34:33 +00:00
m_pCookieDetectionFailedStaticCtrl = NULL ;
m_pCookieDetectionFailedCtrl = NULL ;
2006-01-27 00:34:53 +00:00
m_pAccountQuestionStaticCtrl = NULL ;
2006-02-01 12:18:10 +00:00
m_pAccountInformationStaticCtrl = NULL ;
2006-01-27 00:34:53 +00:00
m_pAccountCreateCtrl = NULL ;
m_pAccountUseExistingCtrl = NULL ;
m_pAccountEmailAddressStaticCtrl = NULL ;
m_pAccountEmailAddressCtrl = NULL ;
m_pAccountPasswordStaticCtrl = NULL ;
m_pAccountPasswordCtrl = NULL ;
m_pAccountConfirmPasswordStaticCtrl = NULL ;
m_pAccountConfirmPasswordCtrl = NULL ;
m_pAccountPasswordRequirmentsStaticCtrl = NULL ;
2009-06-03 08:59:24 +00:00
m_pAccountManagerLinkLabelStaticCtrl = NULL ;
2008-01-14 19:30:19 +00:00
m_pAccountForgotPasswordCtrl = NULL ;
2005-09-26 11:29:28 +00:00
////@end CAccountInfoPage member initialisation
////@begin CAccountInfoPage creation
wxBitmap wizardBitmap ( wxNullBitmap ) ;
2007-03-09 23:44:34 +00:00
wxWizardPageEx : : Create ( parent , ID_ACCOUNTINFOPAGE , wizardBitmap ) ;
2005-09-26 11:29:28 +00:00
CreateControls ( ) ;
GetSizer ( ) - > Fit ( this ) ;
////@end CAccountInfoPage creation
return TRUE ;
}
/*!
* Control creation for AccountInfoPage
*/
void CAccountInfoPage : : CreateControls ( )
{
////@begin CAccountInfoPage content construction
CAccountInfoPage * itemWizardPage56 = this ;
wxBoxSizer * itemBoxSizer57 = new wxBoxSizer ( wxVERTICAL ) ;
itemWizardPage56 - > SetSizer ( itemBoxSizer57 ) ;
2006-01-27 00:34:53 +00:00
m_pTitleStaticCtrl = new wxStaticText ;
m_pTitleStaticCtrl - > Create ( itemWizardPage56 , wxID_STATIC , wxEmptyString , wxDefaultPosition , wxDefaultSize , 0 ) ;
m_pTitleStaticCtrl - > SetFont ( wxFont ( 10 , wxSWISS , wxNORMAL , wxBOLD , FALSE , _T ( " Verdana " ) ) ) ;
itemBoxSizer57 - > Add ( m_pTitleStaticCtrl , 0 , wxALIGN_LEFT | wxGROW | wxALL , 5 ) ;
2005-09-26 11:29:28 +00:00
2009-06-12 21:34:33 +00:00
m_pCookieDetectionFailedStaticCtrl = new wxStaticText ;
m_pCookieDetectionFailedStaticCtrl - > Create ( itemWizardPage56 , wxID_STATIC , wxEmptyString , wxDefaultPosition , wxDefaultSize , 0 ) ;
itemBoxSizer57 - > Add ( m_pCookieDetectionFailedStaticCtrl , 0 , wxALIGN_LEFT | wxALL , 5 ) ;
m_pCookieDetectionFailedCtrl = new wxHyperLink ;
m_pCookieDetectionFailedCtrl - > Create ( itemWizardPage56 , ID_ACCOUNTCOOKIEDETECTIONFAILEDCTRL , wxEmptyString , wxDefaultPosition , wxDefaultSize , 0 ) ;
itemBoxSizer57 - > Add ( m_pCookieDetectionFailedCtrl , 0 , wxALIGN_LEFT | wxALL , 5 ) ;
2006-01-27 00:34:53 +00:00
m_pAccountQuestionStaticCtrl = new wxStaticText ;
m_pAccountQuestionStaticCtrl - > Create ( itemWizardPage56 , wxID_STATIC , wxEmptyString , wxDefaultPosition , wxDefaultSize , 0 ) ;
itemBoxSizer57 - > Add ( m_pAccountQuestionStaticCtrl , 0 , wxALIGN_LEFT | wxALL , 5 ) ;
2005-09-26 11:29:28 +00:00
2006-01-27 00:34:53 +00:00
wxFlexGridSizer * itemFlexGridSizer61 = new wxFlexGridSizer ( 1 , 2 , 0 , 0 ) ;
itemFlexGridSizer61 - > AddGrowableCol ( 1 ) ;
itemBoxSizer57 - > Add ( itemFlexGridSizer61 , 0 , wxGROW | wxALL , 5 ) ;
2005-09-26 11:29:28 +00:00
2006-01-27 00:34:53 +00:00
m_pAccountCreateCtrl = new wxRadioButton ;
m_pAccountCreateCtrl - > Create ( itemWizardPage56 , ID_ACCOUNTCREATECTRL , wxEmptyString , wxDefaultPosition , wxDefaultSize , wxRB_GROUP ) ;
m_pAccountCreateCtrl - > SetValue ( TRUE ) ;
itemFlexGridSizer61 - > Add ( m_pAccountCreateCtrl , 0 , wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
2005-09-26 11:29:28 +00:00
2006-01-27 00:34:53 +00:00
m_pAccountUseExistingCtrl = new wxRadioButton ;
m_pAccountUseExistingCtrl - > Create ( itemWizardPage56 , ID_ACCOUNTUSEEXISTINGCTRL , wxEmptyString , wxDefaultPosition , wxDefaultSize , 0 ) ;
m_pAccountUseExistingCtrl - > SetValue ( FALSE ) ;
itemFlexGridSizer61 - > Add ( m_pAccountUseExistingCtrl , 0 , wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
2006-01-15 12:10:42 +00:00
2006-01-27 00:34:53 +00:00
m_pAccountInformationStaticCtrl = new wxStaticText ;
m_pAccountInformationStaticCtrl - > Create ( itemWizardPage56 , wxID_STATIC , wxEmptyString , wxDefaultPosition , wxDefaultSize , 0 ) ;
itemBoxSizer57 - > Add ( m_pAccountInformationStaticCtrl , 0 , wxALIGN_LEFT | wxALL , 5 ) ;
2006-01-15 12:10:42 +00:00
2006-01-25 11:58:02 +00:00
wxFlexGridSizer * itemFlexGridSizer64 = new wxFlexGridSizer ( 4 , 2 , 0 , 0 ) ;
2005-09-26 11:29:28 +00:00
itemFlexGridSizer64 - > AddGrowableCol ( 1 ) ;
2006-10-31 01:22:29 +00:00
itemBoxSizer57 - > Add ( itemFlexGridSizer64 , 0 , wxEXPAND | wxALL , 0 ) ;
2005-09-26 11:29:28 +00:00
2006-01-27 00:34:53 +00:00
m_pAccountEmailAddressStaticCtrl = new wxStaticText ;
m_pAccountEmailAddressStaticCtrl - > Create ( itemWizardPage56 , ID_ACCOUNTEMAILADDRESSSTATICCTRL , wxEmptyString , wxDefaultPosition , wxDefaultSize , 0 ) ;
itemFlexGridSizer64 - > Add ( m_pAccountEmailAddressStaticCtrl , 0 , wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
2005-09-26 11:29:28 +00:00
2006-01-27 00:34:53 +00:00
m_pAccountEmailAddressCtrl = new wxTextCtrl ;
2008-01-24 22:09:09 +00:00
m_pAccountEmailAddressCtrl - > Create ( itemWizardPage56 , ID_ACCOUNTEMAILADDRESSCTRL , wxEmptyString , wxDefaultPosition , wxSize ( 200 , 22 ) , 0 ) ;
2006-10-31 01:22:29 +00:00
itemFlexGridSizer64 - > Add ( m_pAccountEmailAddressCtrl , 0 , wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
2005-09-26 11:29:28 +00:00
2006-01-27 00:34:53 +00:00
m_pAccountPasswordStaticCtrl = new wxStaticText ;
m_pAccountPasswordStaticCtrl - > Create ( itemWizardPage56 , ID_ACCOUNTPASSWORDSTATICCTRL , wxEmptyString , wxDefaultPosition , wxDefaultSize , 0 ) ;
itemFlexGridSizer64 - > Add ( m_pAccountPasswordStaticCtrl , 0 , wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
2005-09-26 11:29:28 +00:00
2006-01-27 00:34:53 +00:00
m_pAccountPasswordCtrl = new wxTextCtrl ;
m_pAccountPasswordCtrl - > Create ( itemWizardPage56 , ID_ACCOUNTPASSWORDCTRL , wxEmptyString , wxDefaultPosition , wxDefaultSize , wxTE_PASSWORD ) ;
2006-10-31 01:22:29 +00:00
itemFlexGridSizer64 - > Add ( m_pAccountPasswordCtrl , 0 , wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
2005-09-26 11:29:28 +00:00
2006-01-27 00:34:53 +00:00
m_pAccountConfirmPasswordStaticCtrl = new wxStaticText ;
m_pAccountConfirmPasswordStaticCtrl - > Create ( itemWizardPage56 , ID_ACCOUNTCONFIRMPASSWORDSTATICCTRL , wxEmptyString , wxDefaultPosition , wxDefaultSize , 0 ) ;
itemFlexGridSizer64 - > Add ( m_pAccountConfirmPasswordStaticCtrl , 0 , wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
2005-09-26 11:29:28 +00:00
2006-01-27 00:34:53 +00:00
m_pAccountConfirmPasswordCtrl = new wxTextCtrl ;
m_pAccountConfirmPasswordCtrl - > Create ( itemWizardPage56 , ID_ACCOUNTCONFIRMPASSWORDCTRL , wxEmptyString , wxDefaultPosition , wxDefaultSize , wxTE_PASSWORD ) ;
2006-10-31 01:22:29 +00:00
itemFlexGridSizer64 - > Add ( m_pAccountConfirmPasswordCtrl , 0 , wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
2005-11-07 10:44:37 +00:00
2006-01-25 11:58:02 +00:00
itemFlexGridSizer64 - > Add ( 0 , 0 ) ;
2005-11-07 10:44:37 +00:00
2006-01-27 00:34:53 +00:00
m_pAccountPasswordRequirmentsStaticCtrl = new wxStaticText ;
m_pAccountPasswordRequirmentsStaticCtrl - > Create ( itemWizardPage56 , ID_ACCOUNTREQUIREMENTSSTATICCTRL , wxEmptyString , wxDefaultPosition , wxDefaultSize , 0 ) ;
m_pAccountPasswordRequirmentsStaticCtrl - > SetFont ( wxFont ( 7 , wxDEFAULT , wxNORMAL , wxNORMAL , FALSE ) ) ;
itemFlexGridSizer64 - > Add ( m_pAccountPasswordRequirmentsStaticCtrl , 0 , wxGROW | wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
2005-09-26 11:29:28 +00:00
2009-06-03 08:59:24 +00:00
m_pAccountManagerLinkLabelStaticCtrl = new wxStaticText ;
m_pAccountManagerLinkLabelStaticCtrl - > Create ( itemWizardPage56 , ID_ACCOUNTLINKLABELSTATICCTRL , wxEmptyString , wxDefaultPosition , wxDefaultSize , 0 ) ;
itemBoxSizer57 - > Add ( m_pAccountManagerLinkLabelStaticCtrl , 0 , wxGROW | wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
2008-01-14 19:30:19 +00:00
m_pAccountForgotPasswordCtrl = new wxHyperLink ;
m_pAccountForgotPasswordCtrl - > Create ( itemWizardPage56 , ID_ACCOUNTFORGOTPASSWORDCTRL , wxEmptyString , wxDefaultPosition , wxDefaultSize , 0 ) ;
2009-06-03 08:59:24 +00:00
itemBoxSizer57 - > Add ( m_pAccountForgotPasswordCtrl , 0 , wxGROW | wxALIGN_CENTER_VERTICAL | wxALL , 5 ) ;
2008-01-14 19:30:19 +00:00
2005-09-26 11:29:28 +00:00
// Set validators
2006-01-31 07:31:16 +00:00
// m_pAccountEmailAddressCtrl is setup when the OnPageChange event is fired since
// it can be a username or an email address.
2009-06-04 05:48:01 +00:00
m_pAccountPasswordCtrl - > SetValidator ( wxTextValidator ( wxFILTER_NONE , & m_strAccountPassword ) ) ;
m_pAccountConfirmPasswordCtrl - > SetValidator ( wxTextValidator ( wxFILTER_NONE , & m_strAccountConfirmPassword ) ) ;
2005-09-26 11:29:28 +00:00
////@end CAccountInfoPage content construction
}
/*!
* Gets the previous page .
*/
wxWizardPageEx * CAccountInfoPage : : GetPrev ( ) const
{
return PAGE_TRANSITION_BACK ;
}
/*!
* Gets the next page .
*/
wxWizardPageEx * CAccountInfoPage : : GetNext ( ) const
{
if ( CHECK_CLOSINGINPROGRESS ( ) ) {
// Cancel Event Detected
return PAGE_TRANSITION_NEXT ( ID_COMPLETIONERRORPAGE ) ;
} else if ( IS_ATTACHTOPROJECTWIZARD ( ) ) {
return PAGE_TRANSITION_NEXT ( ID_PROJECTPROCESSINGPAGE ) ;
2006-01-27 00:34:53 +00:00
} else if ( IS_ACCOUNTMANAGERWIZARD ( ) ) {
2005-09-26 11:29:28 +00:00
return PAGE_TRANSITION_NEXT ( ID_ACCOUNTMANAGERPROCESSINGPAGE ) ;
}
return NULL ;
}
/*!
* Should we show tooltips ?
*/
bool CAccountInfoPage : : ShowToolTips ( )
{
return TRUE ;
}
/*!
* Get bitmap resources
*/
2006-07-21 08:23:26 +00:00
wxBitmap CAccountInfoPage : : GetBitmapResource ( const wxString & WXUNUSED ( name ) )
2005-09-26 11:29:28 +00:00
{
// Bitmap retrieval
////@begin CAccountInfoPage bitmap retrieval
return wxNullBitmap ;
////@end CAccountInfoPage bitmap retrieval
}
/*!
* Get icon resources
*/
2006-07-21 08:23:26 +00:00
wxIcon CAccountInfoPage : : GetIconResource ( const wxString & WXUNUSED ( name ) )
2005-09-26 11:29:28 +00:00
{
// Icon retrieval
////@begin CAccountInfoPage icon retrieval
return wxNullIcon ;
////@end CAccountInfoPage icon retrieval
}
/*!
* wxEVT_WIZARD_PAGE_CHANGED event handler for ID_ACCOUNTINFOPAGE
*/
2006-01-27 00:34:53 +00:00
void CAccountInfoPage : : OnPageChanged ( wxWizardExEvent & event ) {
2005-09-26 11:29:28 +00:00
if ( event . GetDirection ( ) = = false ) return ;
2009-01-29 15:44:45 +00:00
PROJECT_CONFIG & pc = ( ( CBOINCBaseWizard * ) GetParent ( ) ) - > project_config ;
2008-01-14 19:30:19 +00:00
CSkinAdvanced * pSkinAdvanced = wxGetApp ( ) . GetSkinManager ( ) - > GetAdvanced ( ) ;
CSkinWizardATAM * pSkinWizardATAM = wxGetApp ( ) . GetSkinManager ( ) - > GetWizards ( ) - > GetWizardATAM ( ) ;
CWizardAttachProject * pWAP = ( ( CWizardAttachProject * ) GetParent ( ) ) ;
2009-01-29 15:44:45 +00:00
wxString strBaseConfigLocation = wxString ( wxT ( " /Wizards " ) ) ;
wxConfigBase * pConfig = wxConfigBase : : Get ( FALSE ) ;
2006-10-20 15:00:14 +00:00
wxASSERT ( pSkinAdvanced ) ;
wxASSERT ( pSkinWizardATAM ) ;
2009-06-03 08:59:24 +00:00
wxASSERT ( pWAP ) ;
2006-01-27 00:34:53 +00:00
wxASSERT ( m_pTitleStaticCtrl ) ;
2009-06-12 21:34:33 +00:00
wxASSERT ( m_pCookieDetectionFailedStaticCtrl ) ;
wxASSERT ( m_pCookieDetectionFailedCtrl ) ;
2006-01-27 00:34:53 +00:00
wxASSERT ( m_pAccountQuestionStaticCtrl ) ;
2006-02-01 12:18:10 +00:00
wxASSERT ( m_pAccountInformationStaticCtrl ) ;
2006-01-27 00:34:53 +00:00
wxASSERT ( m_pAccountCreateCtrl ) ;
wxASSERT ( m_pAccountUseExistingCtrl ) ;
wxASSERT ( m_pAccountEmailAddressStaticCtrl ) ;
wxASSERT ( m_pAccountEmailAddressCtrl ) ;
wxASSERT ( m_pAccountPasswordStaticCtrl ) ;
wxASSERT ( m_pAccountPasswordCtrl ) ;
wxASSERT ( m_pAccountConfirmPasswordStaticCtrl ) ;
wxASSERT ( m_pAccountConfirmPasswordCtrl ) ;
wxASSERT ( m_pAccountPasswordRequirmentsStaticCtrl ) ;
2009-06-03 08:59:24 +00:00
wxASSERT ( m_pAccountManagerLinkLabelStaticCtrl ) ;
2008-01-14 19:30:19 +00:00
wxASSERT ( m_pAccountForgotPasswordCtrl ) ;
2006-10-20 15:00:14 +00:00
wxASSERT ( wxDynamicCast ( pSkinAdvanced , CSkinAdvanced ) ) ;
wxASSERT ( wxDynamicCast ( pSkinWizardATAM , CSkinWizardATAM ) ) ;
2006-01-27 00:34:53 +00:00
2009-01-29 15:44:45 +00:00
// We are entering this page, so reterieve the previously used email
// address.
pConfig - > SetPath ( strBaseConfigLocation ) ;
m_strAccountEmailAddress = pConfig - > Read ( wxT ( " DefaultEmailAddress " ) ) ;
// Setup the desired controls and default values.
2005-09-26 11:29:28 +00:00
static bool bRunOnce = true ;
if ( bRunOnce ) {
bRunOnce = false ;
2006-01-27 00:34:53 +00:00
if ( ! IS_ACCOUNTMANAGERWIZARD ( ) ) {
2006-08-31 08:27:20 +00:00
m_pAccountCreateCtrl - > SetValue ( true ) ;
m_pAccountUseExistingCtrl - > SetValue ( false ) ;
2005-09-29 00:50:19 +00:00
}
2005-09-26 11:29:28 +00:00
}
2006-04-12 02:28:50 +00:00
if ( IS_ACCOUNTMANAGERWIZARD ( ) ) {
2009-06-12 21:34:33 +00:00
if ( ! ( pWAP - > m_bCookieRequired & & ! pWAP - > m_bCredentialsDetected ) ) {
m_pCookieDetectionFailedStaticCtrl - > Hide ( ) ;
m_pCookieDetectionFailedCtrl - > Hide ( ) ;
}
2006-04-05 07:48:14 +00:00
m_pAccountQuestionStaticCtrl - > Hide ( ) ;
m_pAccountCreateCtrl - > SetValue ( false ) ;
m_pAccountCreateCtrl - > Hide ( ) ;
m_pAccountUseExistingCtrl - > SetValue ( true ) ;
m_pAccountUseExistingCtrl - > Hide ( ) ;
m_pAccountConfirmPasswordStaticCtrl - > Hide ( ) ;
m_pAccountConfirmPasswordCtrl - > Hide ( ) ;
m_pAccountPasswordRequirmentsStaticCtrl - > Hide ( ) ;
2009-06-12 21:34:33 +00:00
if ( pWAP - > m_bCookieRequired & & ! pWAP - > m_bCredentialsDetected ) {
m_pAccountManagerLinkLabelStaticCtrl - > Hide ( ) ;
m_pAccountForgotPasswordCtrl - > Hide ( ) ;
}
2009-06-03 08:59:24 +00:00
} else {
2009-06-12 21:34:33 +00:00
m_pCookieDetectionFailedStaticCtrl - > Hide ( ) ;
m_pCookieDetectionFailedCtrl - > Hide ( ) ;
2006-09-08 22:53:28 +00:00
if ( pc . account_creation_disabled | | pc . client_account_creation_disabled ) {
2006-04-05 07:48:14 +00:00
m_pAccountCreateCtrl - > SetValue ( false ) ;
2006-08-31 19:24:38 +00:00
m_pAccountCreateCtrl - > Hide ( ) ;
2006-04-05 07:48:14 +00:00
m_pAccountUseExistingCtrl - > SetValue ( true ) ;
2006-08-31 15:01:41 +00:00
m_pAccountUseExistingCtrl - > Hide ( ) ;
2006-08-31 08:27:20 +00:00
} else {
2006-08-31 19:24:38 +00:00
m_pAccountCreateCtrl - > Show ( ) ;
2006-08-31 08:27:20 +00:00
m_pAccountCreateCtrl - > Enable ( ) ;
2006-08-31 19:24:38 +00:00
m_pAccountUseExistingCtrl - > Show ( ) ;
2006-04-05 07:48:14 +00:00
}
2009-06-12 21:34:33 +00:00
m_pAccountManagerLinkLabelStaticCtrl - > Hide ( ) ;
2006-04-05 07:48:14 +00:00
}
2006-01-27 00:34:53 +00:00
m_pTitleStaticCtrl - > SetLabel (
2009-06-03 08:59:24 +00:00
_ ( " Identify your account " )
2006-01-27 00:34:53 +00:00
) ;
if ( ! IS_ACCOUNTMANAGERWIZARD ( ) & & ! IS_ACCOUNTMANAGERUPDATEWIZARD ( ) ) {
2006-09-08 22:53:28 +00:00
if ( pc . client_account_creation_disabled ) {
2006-09-06 16:47:04 +00:00
m_pAccountQuestionStaticCtrl - > SetLabel (
2008-07-08 20:05:07 +00:00
_ ( " Please enter your account information \n (to create an account, visit the project's web site) " )
2006-09-06 16:47:04 +00:00
) ;
2006-09-08 22:53:28 +00:00
} else if ( pc . account_creation_disabled ) {
2006-08-31 15:01:41 +00:00
m_pAccountQuestionStaticCtrl - > SetLabel (
2008-07-08 20:05:07 +00:00
_ ( " This project is not currently accepting new accounts. \n You can attach only if you already have an account. " )
2006-08-31 15:01:41 +00:00
) ;
} else {
m_pAccountQuestionStaticCtrl - > SetLabel (
_ ( " Are you already running this project? " )
) ;
}
2006-01-27 00:34:53 +00:00
m_pAccountCreateCtrl - > SetLabel (
_ ( " &No, new user " )
) ;
m_pAccountUseExistingCtrl - > SetLabel (
_ ( " &Yes, existing user " )
) ;
} else {
2009-06-12 21:34:33 +00:00
if ( pWAP - > m_bCookieRequired & & ! pWAP - > m_bCredentialsDetected ) {
m_pCookieDetectionFailedStaticCtrl - > SetLabel (
2009-06-13 00:54:29 +00:00
_ ( " We were not able to set up your account information \n automatically. \n \n Please click on the 'Find logon information' link \n below to find out what to put in the email address and \n password fields. " )
2009-06-12 21:34:33 +00:00
) ;
m_pCookieDetectionFailedCtrl - > SetLabel (
_ ( " Find logon information " )
) ;
m_pCookieDetectionFailedCtrl - > SetURL (
pWAP - > m_strCookieFailureURL
) ;
}
2006-10-20 15:00:14 +00:00
if ( pSkinAdvanced - > IsBranded ( ) & &
! pSkinWizardATAM - > GetAccountInfoMessage ( ) . IsEmpty ( ) ) {
2006-02-01 12:18:10 +00:00
m_pAccountInformationStaticCtrl - > SetLabel (
2006-10-20 15:00:14 +00:00
pSkinWizardATAM - > GetAccountInfoMessage ( )
2006-02-01 12:18:10 +00:00
) ;
}
2006-01-27 00:34:53 +00:00
}
2006-03-06 17:31:02 +00:00
if ( m_pAccountUseExistingCtrl - > GetValue ( ) ) {
2006-08-31 21:29:44 +00:00
m_pAccountConfirmPasswordStaticCtrl - > Hide ( ) ;
m_pAccountConfirmPasswordCtrl - > Hide ( ) ;
m_pAccountPasswordRequirmentsStaticCtrl - > Hide ( ) ;
2006-03-06 17:31:02 +00:00
m_pAccountPasswordStaticCtrl - > SetLabel (
_ ( " &Password: " )
) ;
} else {
2006-08-31 21:29:44 +00:00
m_pAccountConfirmPasswordStaticCtrl - > Show ( ) ;
m_pAccountConfirmPasswordCtrl - > Show ( ) ;
m_pAccountPasswordRequirmentsStaticCtrl - > Show ( ) ;
2006-03-06 17:31:02 +00:00
m_pAccountPasswordStaticCtrl - > SetLabel (
_ ( " Choose a &password: " )
) ;
2006-08-31 21:29:44 +00:00
m_pAccountConfirmPasswordStaticCtrl - > SetLabel (
_ ( " C&onfirm password: " )
) ;
2006-03-06 17:31:02 +00:00
}
2006-01-15 12:10:42 +00:00
if ( ! ( ( CBOINCBaseWizard * ) GetParent ( ) ) - > project_name . IsEmpty ( ) ) {
wxString strQuestion ;
strQuestion . Printf (
2007-07-11 16:26:44 +00:00
_ ( " Are you already running %s? " ) ,
2006-01-15 12:10:42 +00:00
( ( CBOINCBaseWizard * ) GetParent ( ) ) - > project_name . c_str ( )
) ;
2006-01-27 00:34:53 +00:00
m_pAccountQuestionStaticCtrl - > SetLabel ( strQuestion ) ;
2006-01-15 12:10:42 +00:00
}
2005-09-26 11:29:28 +00:00
if ( ( ( CBOINCBaseWizard * ) GetParent ( ) ) - > project_config . uses_username ) {
2006-10-20 15:00:14 +00:00
if ( IS_ACCOUNTMANAGERWIZARD ( ) ) {
if ( pSkinAdvanced - > IsBranded ( ) & &
! pSkinWizardATAM - > GetAccountInfoMessage ( ) . IsEmpty ( ) ) {
2006-02-01 12:18:10 +00:00
m_pAccountInformationStaticCtrl - > SetLabel (
2006-10-20 15:00:14 +00:00
pSkinWizardATAM - > GetAccountInfoMessage ( )
2006-02-01 12:18:10 +00:00
) ;
}
2006-01-04 13:14:14 +00:00
}
2006-10-20 15:00:14 +00:00
2006-01-27 00:34:53 +00:00
m_pAccountEmailAddressStaticCtrl - > SetLabel (
2006-02-01 12:18:10 +00:00
_ ( " &Username: " )
2005-09-26 11:29:28 +00:00
) ;
2006-01-31 07:31:16 +00:00
m_pAccountEmailAddressCtrl - > SetValidator ( wxTextValidator ( wxFILTER_ASCII , & m_strAccountEmailAddress ) ) ;
2005-09-26 11:29:28 +00:00
} else {
2006-10-20 15:00:14 +00:00
if ( IS_ACCOUNTMANAGERWIZARD ( ) ) {
if ( pSkinAdvanced - > IsBranded ( ) & &
! pSkinWizardATAM - > GetAccountInfoMessage ( ) . IsEmpty ( ) ) {
2006-02-01 12:18:10 +00:00
m_pAccountInformationStaticCtrl - > SetLabel (
2006-10-20 15:00:14 +00:00
pSkinWizardATAM - > GetAccountInfoMessage ( )
2006-02-01 12:18:10 +00:00
) ;
}
}
2006-10-20 15:00:14 +00:00
2006-01-27 00:34:53 +00:00
m_pAccountEmailAddressStaticCtrl - > SetLabel (
2006-02-01 12:18:10 +00:00
_ ( " &Email address: " )
2005-09-26 11:29:28 +00:00
) ;
2006-01-31 07:31:16 +00:00
m_pAccountEmailAddressCtrl - > SetValidator ( CValidateEmailAddress ( & m_strAccountEmailAddress ) ) ;
2009-01-29 15:44:45 +00:00
m_pAccountEmailAddressCtrl - > SetValue ( m_strAccountEmailAddress ) ;
2005-09-26 11:29:28 +00:00
}
2006-01-25 11:58:02 +00:00
2008-11-25 22:58:14 +00:00
if ( pc . min_passwd_length ) {
2006-01-25 11:58:02 +00:00
wxString str ;
2008-11-25 22:58:14 +00:00
str . Printf ( _ ( " minimum length %d " ) , pc . min_passwd_length ) ;
2006-01-27 00:34:53 +00:00
m_pAccountPasswordRequirmentsStaticCtrl - > SetLabel ( str ) ;
2006-01-25 11:58:02 +00:00
}
2008-01-14 19:30:19 +00:00
2009-06-03 04:01:29 +00:00
if ( ! IS_ACCOUNTMANAGERWIZARD ( ) ) {
2009-06-03 08:59:24 +00:00
m_pAccountForgotPasswordCtrl - > SetLabel (
_ ( " Forgot your password? " )
) ;
2009-06-03 04:01:29 +00:00
m_pAccountForgotPasswordCtrl - > SetURL (
wxString ( pWAP - > m_ProjectInfoPage - > GetProjectURL ( ) + _T ( " get_passwd.php " ) )
) ;
} else {
2009-06-03 08:59:24 +00:00
m_pAccountManagerLinkLabelStaticCtrl - > SetLabel (
2009-06-03 22:05:55 +00:00
_ ( " If you have not yet registered with this account manager, \n please do so before proceeding. Click on the link below \n to register or to retrieve a forgotten password. " )
2009-06-03 08:59:24 +00:00
) ;
m_pAccountForgotPasswordCtrl - > SetLabel (
_ ( " Account manager website " )
) ;
2009-06-03 04:01:29 +00:00
m_pAccountForgotPasswordCtrl - > SetURL (
2009-06-03 08:59:24 +00:00
wxString ( pWAP - > m_AccountManagerInfoPage - > GetProjectURL ( ) )
2009-06-03 04:01:29 +00:00
) ;
}
2008-01-14 19:30:19 +00:00
2006-01-27 00:34:53 +00:00
Fit ( ) ;
2006-02-14 21:41:22 +00:00
m_pAccountEmailAddressCtrl - > SetFocus ( ) ;
2005-09-26 11:29:28 +00:00
}
/*!
* wxEVT_WIZARD_PAGE_CHANGING event handler for ID_ACCOUNTINFOPAGE
*/
void CAccountInfoPage : : OnPageChanging ( wxWizardExEvent & event )
{
if ( event . GetDirection ( ) = = false ) return ;
2009-01-29 15:44:45 +00:00
wxString strTitle ;
wxString strMessage = wxT ( " " ) ;
bool bDisplayError = false ;
wxString strBaseConfigLocation = wxString ( wxT ( " /Wizards " ) ) ;
wxConfigBase * pConfig = wxConfigBase : : Get ( FALSE ) ;
2005-09-26 11:29:28 +00:00
if ( ! CHECK_CLOSINGINPROGRESS ( ) ) {
2009-01-29 15:44:45 +00:00
// We are leaving this page, so store the email address for future
// use.
pConfig - > SetPath ( strBaseConfigLocation ) ;
pConfig - > Write ( wxT ( " DefaultEmailAddress " ) , m_strAccountEmailAddress ) ;
// Construct potiental dialog title
2005-09-26 11:29:28 +00:00
if ( IS_ATTACHTOPROJECTWIZARD ( ) ) {
2005-09-29 21:47:12 +00:00
strTitle = _ ( " Attach to project " ) ;
2006-01-27 00:34:53 +00:00
} else if ( IS_ACCOUNTMANAGERWIZARD ( ) & & IS_ACCOUNTMANAGERUPDATEWIZARD ( ) ) {
strTitle = _ ( " Update account manager " ) ;
} else if ( IS_ACCOUNTMANAGERWIZARD ( ) ) {
2005-09-29 21:47:12 +00:00
strTitle = _ ( " Attach to account manager " ) ;
2005-09-26 11:29:28 +00:00
}
2005-09-30 18:41:38 +00:00
// Verify minimum password length
unsigned int iMinLength = ( ( CBOINCBaseWizard * ) GetParent ( ) ) - > project_config . min_passwd_length ;
2006-01-27 00:34:53 +00:00
wxString strPassword = m_pAccountPasswordCtrl - > GetValue ( ) ;
2005-09-30 18:41:38 +00:00
if ( strPassword . Length ( ) < iMinLength ) {
2005-09-30 18:46:33 +00:00
if ( IS_ATTACHTOPROJECTWIZARD ( ) ) {
strMessage . Printf (
2006-09-01 00:01:33 +00:00
_ ( " The minimum password length for this project is %d. Please enter a different password. " ) ,
2005-09-30 18:46:33 +00:00
iMinLength
) ;
}
2006-01-27 00:34:53 +00:00
if ( IS_ACCOUNTMANAGERWIZARD ( ) ) {
2005-09-30 18:46:33 +00:00
strMessage . Printf (
2006-09-01 00:01:33 +00:00
_ ( " The minimum password length for this account manager is %d. Please enter a different password. " ) ,
2005-09-30 18:46:33 +00:00
iMinLength
) ;
}
2005-09-30 18:41:38 +00:00
bDisplayError = true ;
}
2006-01-27 00:34:53 +00:00
if ( ! IS_ACCOUNTMANAGERWIZARD ( ) & & m_pAccountCreateCtrl - > GetValue ( ) ) {
2005-09-26 11:29:28 +00:00
// Verify that the password and confirmation password math.
2006-01-27 00:34:53 +00:00
if ( m_pAccountPasswordCtrl - > GetValue ( ) ! = m_pAccountConfirmPasswordCtrl - > GetValue ( ) ) {
2005-09-26 11:29:28 +00:00
strMessage = _ ( " The password and confirmation password do not match. Please type them again. " ) ;
bDisplayError = true ;
}
}
if ( bDisplayError ) {
2008-08-20 16:07:06 +00:00
wxGetApp ( ) . SafeMessageBox (
2005-09-26 11:29:28 +00:00
strMessage ,
strTitle ,
wxICON_ERROR | wxOK ,
this
) ;
event . Veto ( ) ;
}
}
}
/*!
* wxEVT_WIZARD_CANCEL event handler for ID_ACCOUNTINFOPAGE
*/
void CAccountInfoPage : : OnCancel ( wxWizardExEvent & event ) {
PROCESS_CANCELEVENT ( event ) ;
}
/*!
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_ACCOUNTUSEXISTINGBUTTON
*/
2006-07-21 08:23:26 +00:00
void CAccountInfoPage : : OnAccountUseExistingCtrlSelected ( wxCommandEvent & WXUNUSED ( event ) ) {
2006-03-06 17:31:02 +00:00
m_pAccountPasswordStaticCtrl - > SetLabel (
_ ( " &Password: " )
) ;
2006-01-27 00:34:53 +00:00
m_pAccountConfirmPasswordStaticCtrl - > Hide ( ) ;
m_pAccountConfirmPasswordCtrl - > Hide ( ) ;
2006-03-06 17:41:52 +00:00
m_pAccountPasswordRequirmentsStaticCtrl - > Hide ( ) ;
2006-01-27 00:34:53 +00:00
m_pAccountEmailAddressCtrl - > SetFocus ( ) ;
2007-03-06 00:35:04 +00:00
Fit ( ) ;
2005-09-26 11:29:28 +00:00
}
/*!
* wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_ACCOUNTCREATEBUTTON
*/
2006-07-21 08:23:26 +00:00
void CAccountInfoPage : : OnAccountCreateCtrlSelected ( wxCommandEvent & WXUNUSED ( event ) ) {
2006-03-06 17:31:02 +00:00
m_pAccountPasswordStaticCtrl - > SetLabel (
_ ( " Choose a &password: " )
) ;
2006-01-27 00:34:53 +00:00
m_pAccountConfirmPasswordStaticCtrl - > Show ( ) ;
m_pAccountConfirmPasswordCtrl - > Show ( ) ;
2006-03-06 17:41:52 +00:00
m_pAccountPasswordRequirmentsStaticCtrl - > Show ( ) ;
2006-01-27 00:34:53 +00:00
m_pAccountEmailAddressCtrl - > SetFocus ( ) ;
2007-03-06 00:35:04 +00:00
Fit ( ) ;
2005-09-26 11:29:28 +00:00
}