*** empty log message ***

svn path=/trunk/boinc/; revision=9382
This commit is contained in:
Rom Walton 2006-02-02 08:33:23 +00:00
parent 08a55ee4b0
commit f68f8a156d
4 changed files with 56 additions and 43 deletions

View File

@ -1360,3 +1360,15 @@ David 1 Feb 2006
app.h app.h
app_control.C app_control.C
gui_rpc_server_ops.C gui_rpc_server_ops.C
Rom 2 Feb 2006
- Bug Fix: Always use the ai.email_addr field for the user identifier for
both the create_account and lookup_account RPCs. ai.user_name is only
used to prepopulate the post account creation setup form.
client/
acct_setup.h
clientgui/
ProjectProcessingPage.cpp
lib/
gui_rpc_client.h

View File

@ -39,7 +39,12 @@ struct PROJECT_INIT {
struct ACCOUNT_IN { struct ACCOUNT_IN {
std::string url; std::string url;
std::string email_addr; std::string email_addr;
// this is the account identifier. on systems that use
// usernames it is the username, on systems that use
// email addresses it is an email address for the user.
std::string user_name; std::string user_name;
// this is the suggested friendly name for the user
// during account creation.
std::string passwd_hash; std::string passwd_hash;
void parse(char*); void parse(char*);

View File

@ -344,8 +344,9 @@ void CProjectProcessingPage::OnCancel( wxWizardExEvent& event ) {
void CProjectProcessingPage::OnStateChange( CProjectProcessingPageEvent& event ) void CProjectProcessingPage::OnStateChange( CProjectProcessingPageEvent& event )
{ {
CMainDocument* pDoc = wxGetApp().GetDocument(); CMainDocument* pDoc = wxGetApp().GetDocument();
ACCOUNT_IN* ai = &((CWizardAttachProject*)GetParent())->account_in; CWizardAttachProject* pWAP = ((CWizardAttachProject*)GetParent());
ACCOUNT_OUT* ao = &((CWizardAttachProject*)GetParent())->account_out; ACCOUNT_IN* ai = &pWAP->account_in;
ACCOUNT_OUT* ao = &pWAP->account_out;
unsigned int i; unsigned int i;
PROJECT_ATTACH_REPLY reply; PROJECT_ATTACH_REPLY reply;
wxString strBuffer = wxEmptyString; wxString strBuffer = wxEmptyString;
@ -360,8 +361,8 @@ void CProjectProcessingPage::OnStateChange( CProjectProcessingPageEvent& event )
switch(GetCurrentState()) { switch(GetCurrentState()) {
case ATTACHPROJECT_INIT: case ATTACHPROJECT_INIT:
((CWizardAttachProject*)GetParent())->DisableNextButton(); pWAP->DisableNextButton();
((CWizardAttachProject*)GetParent())->DisableBackButton(); pWAP->DisableBackButton();
StartProgress(m_pProgressIndicator); StartProgress(m_pProgressIndicator);
SetNextState(ATTACHPROJECT_ACCOUNTQUERY_BEGIN); SetNextState(ATTACHPROJECT_ACCOUNTQUERY_BEGIN);
@ -374,25 +375,22 @@ void CProjectProcessingPage::OnStateChange( CProjectProcessingPageEvent& event )
ai->clear(); ai->clear();
ao->clear(); ao->clear();
ai->url = ((CWizardAttachProject*)GetParent())->m_ProjectInfoPage->GetProjectURL().c_str(); ai->url = pWAP->m_ProjectInfoPage->GetProjectURL().c_str();
if (!((CWizardAttachProject*)GetParent())->m_AccountKeyPage->m_strAccountKey.IsEmpty() || if (!pWAP->m_AccountKeyPage->m_strAccountKey.IsEmpty() ||
((CWizardAttachProject*)GetParent())->m_bCredentialsCached pWAP->m_bCredentialsCached
) { ) {
if (!((CWizardAttachProject*)GetParent())->m_bCredentialsCached) { if (!pWAP->m_bCredentialsCached) {
ao->authenticator = ((CWizardAttachProject*)GetParent())->m_AccountKeyPage->m_strAccountKey.c_str(); ao->authenticator = pWAP->m_AccountKeyPage->m_strAccountKey.c_str();
} }
SetProjectCommunitcationsSucceeded(true); SetProjectCommunitcationsSucceeded(true);
} else { } else {
if (((CWizardAttachProject*)GetParent())->m_AccountInfoPage->m_pAccountCreateCtrl->GetValue()) { // Setup initial values for both the create and lookup API
if (!((CWizardAttachProject*)GetParent())->project_config.uses_username) { ai->email_addr = pWAP->m_AccountInfoPage->GetAccountEmailAddress().c_str();
ai->email_addr = ((CWizardAttachProject*)GetParent())->m_AccountInfoPage->GetAccountEmailAddress().c_str(); ai->passwd = pWAP->m_AccountInfoPage->GetAccountPassword().c_str();
ai->user_name = ::wxGetUserName().c_str(); ai->user_name = ::wxGetUserName().c_str();
} else {
ai->email_addr = wxT(""); if (pWAP->m_AccountInfoPage->m_pAccountCreateCtrl->GetValue()) {
ai->user_name = ((CWizardAttachProject*)GetParent())->m_AccountInfoPage->GetAccountEmailAddress().c_str();
}
ai->passwd = ((CWizardAttachProject*)GetParent())->m_AccountInfoPage->GetAccountPassword().c_str();
pDoc->rpc.create_account(*ai); pDoc->rpc.create_account(*ai);
// Wait until we are done processing the request. // Wait until we are done processing the request.
@ -402,7 +400,7 @@ void CProjectProcessingPage::OnStateChange( CProjectProcessingPageEvent& event )
iReturnValue = ERR_IN_PROGRESS; iReturnValue = ERR_IN_PROGRESS;
while (ERR_IN_PROGRESS == iReturnValue && while (ERR_IN_PROGRESS == iReturnValue &&
tsExecutionTime.GetSeconds() <= 60 && tsExecutionTime.GetSeconds() <= 60 &&
!((CWizardAttachProject*)GetParent())->IsCancelInProgress() !pWAP->IsCancelInProgress()
) )
{ {
dtCurrentExecutionTime = wxDateTime::Now(); dtCurrentExecutionTime = wxDateTime::Now();
@ -416,16 +414,9 @@ void CProjectProcessingPage::OnStateChange( CProjectProcessingPageEvent& event )
} }
if ((!iReturnValue) && !ao->error_num && !CHECK_DEBUG_FLAG(WIZDEBUG_ERRPROJECTCOMM)) { if ((!iReturnValue) && !ao->error_num && !CHECK_DEBUG_FLAG(WIZDEBUG_ERRPROJECTCOMM)) {
((CWizardAttachProject*)GetParent())->SetAccountCreatedSuccessfully(true); pWAP->SetAccountCreatedSuccessfully(true);
} }
} else { } else {
if (!((CWizardAttachProject*)GetParent())->project_config.uses_username) {
ai->email_addr = ((CWizardAttachProject*)GetParent())->m_AccountInfoPage->GetAccountEmailAddress().c_str();
} else {
ai->user_name = ((CWizardAttachProject*)GetParent())->m_AccountInfoPage->GetAccountEmailAddress().c_str();
}
ai->passwd = ((CWizardAttachProject*)GetParent())->m_AccountInfoPage->GetAccountPassword().c_str();
pDoc->rpc.lookup_account(*ai); pDoc->rpc.lookup_account(*ai);
// Wait until we are done processing the request. // Wait until we are done processing the request.
@ -470,14 +461,14 @@ void CProjectProcessingPage::OnStateChange( CProjectProcessingPageEvent& event )
} }
if ((HTTP_STATUS_NOT_FOUND == ao->error_num) || CHECK_DEBUG_FLAG(WIZDEBUG_ERRPROJECTPROPERTIESURL)) { if ((HTTP_STATUS_NOT_FOUND == ao->error_num) || CHECK_DEBUG_FLAG(WIZDEBUG_ERRPROJECTPROPERTIESURL)) {
wxString strBuffer = ((CWizardAttachProject*)GetParent())->m_CompletionErrorPage->m_pServerMessagesCtrl->GetLabel(); wxString strBuffer = pWAP->m_CompletionErrorPage->m_pServerMessagesCtrl->GetLabel();
strBuffer += _T("Required wizard file(s) are missing from the target server.\n(lookup_account.php/create_account.php)\n"); strBuffer += _T("Required wizard file(s) are missing from the target server.\n(lookup_account.php/create_account.php)\n");
((CWizardAttachProject*)GetParent())->m_CompletionErrorPage->m_pServerMessagesCtrl->SetLabel(strBuffer); pWAP->m_CompletionErrorPage->m_pServerMessagesCtrl->SetLabel(strBuffer);
} }
if ((HTTP_STATUS_INTERNAL_SERVER_ERROR == ao->error_num) || CHECK_DEBUG_FLAG(WIZDEBUG_ERRPROJECTPROPERTIESURL)) { if ((HTTP_STATUS_INTERNAL_SERVER_ERROR == ao->error_num) || CHECK_DEBUG_FLAG(WIZDEBUG_ERRPROJECTPROPERTIESURL)) {
wxString strBuffer = ((CWizardAttachProject*)GetParent())->m_CompletionErrorPage->m_pServerMessagesCtrl->GetLabel(); wxString strBuffer = pWAP->m_CompletionErrorPage->m_pServerMessagesCtrl->GetLabel();
strBuffer += _T("An internal server error has occurred.\n"); strBuffer += _T("An internal server error has occurred.\n");
((CWizardAttachProject*)GetParent())->m_CompletionErrorPage->m_pServerMessagesCtrl->SetLabel(strBuffer); pWAP->m_CompletionErrorPage->m_pServerMessagesCtrl->SetLabel(strBuffer);
} }
} }
} }
@ -489,7 +480,7 @@ void CProjectProcessingPage::OnStateChange( CProjectProcessingPageEvent& event )
case ATTACHPROJECT_ATTACHPROJECT_EXECUTE: case ATTACHPROJECT_ATTACHPROJECT_EXECUTE:
if (GetProjectCommunitcationsSucceeded()) { if (GetProjectCommunitcationsSucceeded()) {
// Attempt to attach to the project. // Attempt to attach to the project.
if (((CWizardAttachProject*)GetParent())->m_bCredentialsCached) { if (pWAP->m_bCredentialsCached) {
pDoc->rpc.project_attach( pDoc->rpc.project_attach(
ai->url.c_str(), ai->url.c_str(),
ao->authenticator.c_str(), ao->authenticator.c_str(),
@ -525,21 +516,21 @@ void CProjectProcessingPage::OnStateChange( CProjectProcessingPageEvent& event )
if (!iReturnValue && !reply.error_num && !CHECK_DEBUG_FLAG(WIZDEBUG_ERRPROJECTATTACH)) { if (!iReturnValue && !reply.error_num && !CHECK_DEBUG_FLAG(WIZDEBUG_ERRPROJECTATTACH)) {
SetProjectAttachSucceeded(true); SetProjectAttachSucceeded(true);
((CWizardAttachProject*)GetParent())->SetAttachedToProjectSuccessfully(true); pWAP->SetAttachedToProjectSuccessfully(true);
((CWizardAttachProject*)GetParent())->SetProjectURL(ai->url.c_str()); pWAP->SetProjectURL(ai->url.c_str());
((CWizardAttachProject*)GetParent())->SetProjectAuthenticator(ao->authenticator.c_str()); pWAP->SetProjectAuthenticator(ao->authenticator.c_str());
} else { } else {
SetProjectAttachSucceeded(false); SetProjectAttachSucceeded(false);
if ((HTTP_STATUS_INTERNAL_SERVER_ERROR == reply.error_num) || CHECK_DEBUG_FLAG(WIZDEBUG_ERRPROJECTPROPERTIESURL)) { if ((HTTP_STATUS_INTERNAL_SERVER_ERROR == reply.error_num) || CHECK_DEBUG_FLAG(WIZDEBUG_ERRPROJECTPROPERTIESURL)) {
strBuffer = ((CWizardAttachProject*)GetParent())->m_CompletionErrorPage->m_pServerMessagesCtrl->GetLabel(); strBuffer = pWAP->m_CompletionErrorPage->m_pServerMessagesCtrl->GetLabel();
strBuffer += _T("An internal server error has occurred.\n"); strBuffer += _T("An internal server error has occurred.\n");
((CWizardAttachProject*)GetParent())->m_CompletionErrorPage->m_pServerMessagesCtrl->SetLabel(strBuffer); pWAP->m_CompletionErrorPage->m_pServerMessagesCtrl->SetLabel(strBuffer);
} else { } else {
strBuffer = ((CWizardAttachProject*)GetParent())->m_CompletionErrorPage->m_pServerMessagesCtrl->GetLabel(); strBuffer = pWAP->m_CompletionErrorPage->m_pServerMessagesCtrl->GetLabel();
for (i=0; i<reply.messages.size(); i++) { for (i=0; i<reply.messages.size(); i++) {
strBuffer += wxString(reply.messages[i].c_str()) + wxString(wxT("\n")); strBuffer += wxString(reply.messages[i].c_str()) + wxString(wxT("\n"));
} }
((CWizardAttachProject*)GetParent())->m_CompletionErrorPage->m_pServerMessagesCtrl->SetLabel(strBuffer); pWAP->m_CompletionErrorPage->m_pServerMessagesCtrl->SetLabel(strBuffer);
} }
} }
} else { } else {
@ -554,9 +545,9 @@ void CProjectProcessingPage::OnStateChange( CProjectProcessingPageEvent& event )
default: default:
// Allow a glimps of what the result was before advancing to the next page. // Allow a glimps of what the result was before advancing to the next page.
wxSleep(1); wxSleep(1);
((CWizardAttachProject*)GetParent())->EnableNextButton(); pWAP->EnableNextButton();
((CWizardAttachProject*)GetParent())->EnableBackButton(); pWAP->EnableBackButton();
((CWizardAttachProject*)GetParent())->SimulateNextButton(); pWAP->SimulateNextButton();
bPostNewEvent = false; bPostNewEvent = false;
break; break;
} }

View File

@ -462,7 +462,12 @@ struct PROJECT_CONFIG {
struct ACCOUNT_IN { struct ACCOUNT_IN {
std::string url; std::string url;
std::string email_addr; std::string email_addr;
// this is the account identifier. on systems that use
// usernames it is the username, on systems that use
// email addresses it is an email address for the user.
std::string user_name; std::string user_name;
// this is the suggested friendly name for the user
// during account creation.
std::string passwd; std::string passwd;
ACCOUNT_IN(); ACCOUNT_IN();