From 674437a3bc72578c3d771b1e422236574f56eaa8 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Fri, 12 Jun 2009 21:34:33 +0000 Subject: [PATCH] - MGR: Introduce the cookie detection failure URL to the acct_mgr_logon.xml file. If the cookies cannot be found provide a hyperlink control on the AcctountInfo page in the wizard which will point to a fallback URL the user can go to to find out what logon credentials to use. client/ acct_mgr.cpp, .h gui_rpc_server_ops.cpp clientgui/ AccountInfoPage.cpp, .h BOINCWizards.h WizardAttachProject.cpp, .h lib/ gui_rpc_client.h gui_rpc_client_ops.cpp svn path=/trunk/boinc/; revision=18400 --- checkin_notes | 18 ++++++++++++++ client/acct_mgr.cpp | 2 ++ client/acct_mgr.h | 10 ++++++++ client/gui_rpc_server_ops.cpp | 21 +++++++++++++---- clientgui/AccountInfoPage.cpp | 39 +++++++++++++++++++++++++++++-- clientgui/AccountInfoPage.h | 2 ++ clientgui/BOINCWizards.h | 1 + clientgui/WizardAttachProject.cpp | 10 +++++--- clientgui/WizardAttachProject.h | 2 ++ lib/gui_rpc_client.h | 2 ++ lib/gui_rpc_client_ops.cpp | 4 ++++ 11 files changed, 101 insertions(+), 10 deletions(-) diff --git a/checkin_notes b/checkin_notes index 951179f67c..57ff471ed1 100644 --- a/checkin_notes +++ b/checkin_notes @@ -5557,3 +5557,21 @@ Rom 11 June 2009 browser.cpp, .h CompletionPage.cpp WizardAttachProject.cpp, .h + +Rom 11 June 2009 + - MGR: Introduce the cookie detection failure URL to the + acct_mgr_logon.xml file. If the cookies cannot be found provide + a hyperlink control on the AcctountInfo page in the wizard + which will point to a fallback URL the user can go to to + find out what logon credentials to use. + + client/ + acct_mgr.cpp, .h + gui_rpc_server_ops.cpp + clientgui/ + AccountInfoPage.cpp, .h + BOINCWizards.h + WizardAttachProject.cpp, .h + lib/ + gui_rpc_client.h + gui_rpc_client_ops.cpp diff --git a/client/acct_mgr.cpp b/client/acct_mgr.cpp index fae58d3e47..efb204fafb 100644 --- a/client/acct_mgr.cpp +++ b/client/acct_mgr.cpp @@ -654,6 +654,8 @@ int ACCT_MGR_INFO::init() { retval = xp.element_contents("", signing_key, sizeof(signing_key)); continue; } + else if (xp.parse_bool(tag, "cookie_required", cookie_required)) continue; + else if (xp.parse_str(tag, "cookie_failure_url", cookie_failure_url, 256)) continue; if (log_flags.unparsed_xml) { msg_printf(NULL, MSG_INFO, "[unparsed_xml] ACCT_MGR_INFO::init: unrecognized %s", tag diff --git a/client/acct_mgr.h b/client/acct_mgr.h index 28a40ddb80..6448d1fad8 100644 --- a/client/acct_mgr.h +++ b/client/acct_mgr.h @@ -46,6 +46,16 @@ struct ACCT_MGR_INFO { /// whether to include GUI RPC port and password hash /// in AM RPCs (used for "farm management") bool send_gui_rpc_info; + /// use of cookies are required during initial signup + /// NOTE: This bool gets dropped after the client has + /// successfully attached to an account manager + bool cookie_required; + /// if the cookies could not be detected, provide a + /// link to a website to go to so the user can find + /// what login name and password they have been assigned + /// NOTE: This bool gets dropped after the client has + /// successfully attached to an account manager + char cookie_failure_url[256]; bool password_error; ACCT_MGR_INFO(); diff --git a/client/gui_rpc_server_ops.cpp b/client/gui_rpc_server_ops.cpp index 8aa35fd44d..dc384aaa56 100644 --- a/client/gui_rpc_server_ops.cpp +++ b/client/gui_rpc_server_ops.cpp @@ -527,13 +527,24 @@ static void handle_acct_mgr_info(char*, MIOFILE& fout) { fout.printf( "\n" " %s\n" - " %s\n" - " %s\n" - "\n", + " %s\n", gstate.acct_mgr_info.acct_mgr_url, - gstate.acct_mgr_info.acct_mgr_name, - strlen(gstate.acct_mgr_info.login_name)?"":"" + gstate.acct_mgr_info.acct_mgr_name ); + + if (strlen(gstate.acct_mgr_info.login_name)) { + fout.printf(" \n"); + } + + if (gstate.acct_mgr_info.cookie_required) { + fout.printf(" \n"); + fout.printf( + " %s\n", + gstate.acct_mgr_info.cookie_failure_url + ); + } + + fout.printf("\n"); } static void handle_get_statistics(char*, MIOFILE& fout) { diff --git a/clientgui/AccountInfoPage.cpp b/clientgui/AccountInfoPage.cpp index 5719bd5931..ac5079c9a8 100644 --- a/clientgui/AccountInfoPage.cpp +++ b/clientgui/AccountInfoPage.cpp @@ -87,6 +87,8 @@ bool CAccountInfoPage::Create( CBOINCBaseWizard* parent ) ////@begin CAccountInfoPage member initialisation m_pTitleStaticCtrl = NULL; + m_pCookieDetectionFailedStaticCtrl = NULL; + m_pCookieDetectionFailedCtrl = NULL; m_pAccountQuestionStaticCtrl = NULL; m_pAccountInformationStaticCtrl = NULL; m_pAccountCreateCtrl = NULL; @@ -131,6 +133,14 @@ void CAccountInfoPage::CreateControls() m_pTitleStaticCtrl->SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, FALSE, _T("Verdana"))); itemBoxSizer57->Add(m_pTitleStaticCtrl, 0, wxALIGN_LEFT|wxGROW|wxALL, 5); + 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); + m_pAccountQuestionStaticCtrl = new wxStaticText; m_pAccountQuestionStaticCtrl->Create( itemWizardPage56, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer57->Add(m_pAccountQuestionStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5); @@ -282,6 +292,8 @@ void CAccountInfoPage::OnPageChanged( wxWizardExEvent& event ) { wxASSERT(pSkinWizardATAM); wxASSERT(pWAP); wxASSERT(m_pTitleStaticCtrl); + wxASSERT(m_pCookieDetectionFailedStaticCtrl); + wxASSERT(m_pCookieDetectionFailedCtrl); wxASSERT(m_pAccountQuestionStaticCtrl); wxASSERT(m_pAccountInformationStaticCtrl); wxASSERT(m_pAccountCreateCtrl); @@ -315,6 +327,11 @@ void CAccountInfoPage::OnPageChanged( wxWizardExEvent& event ) { } if (IS_ACCOUNTMANAGERWIZARD()) { + if (!(pWAP->m_bCookieRequired && !pWAP->m_bCredentialsDetected)) { + m_pCookieDetectionFailedStaticCtrl->Hide(); + m_pCookieDetectionFailedCtrl->Hide(); + } + m_pAccountQuestionStaticCtrl->Hide(); m_pAccountCreateCtrl->SetValue(false); m_pAccountCreateCtrl->Hide(); @@ -323,9 +340,14 @@ void CAccountInfoPage::OnPageChanged( wxWizardExEvent& event ) { m_pAccountConfirmPasswordStaticCtrl->Hide(); m_pAccountConfirmPasswordCtrl->Hide(); m_pAccountPasswordRequirmentsStaticCtrl->Hide(); - m_pAccountManagerLinkLabelStaticCtrl->Show(); + + if (pWAP->m_bCookieRequired && !pWAP->m_bCredentialsDetected) { + m_pAccountManagerLinkLabelStaticCtrl->Hide(); + m_pAccountForgotPasswordCtrl->Hide(); + } } else { - m_pAccountManagerLinkLabelStaticCtrl->Hide(); + m_pCookieDetectionFailedStaticCtrl->Hide(); + m_pCookieDetectionFailedCtrl->Hide(); if (pc.account_creation_disabled || pc.client_account_creation_disabled) { m_pAccountCreateCtrl->SetValue(false); m_pAccountCreateCtrl->Hide(); @@ -336,6 +358,7 @@ void CAccountInfoPage::OnPageChanged( wxWizardExEvent& event ) { m_pAccountCreateCtrl->Enable(); m_pAccountUseExistingCtrl->Show(); } + m_pAccountManagerLinkLabelStaticCtrl->Hide(); } m_pTitleStaticCtrl->SetLabel( @@ -363,6 +386,18 @@ void CAccountInfoPage::OnPageChanged( wxWizardExEvent& event ) { _("&Yes, existing user") ); } else { + if (pWAP->m_bCookieRequired && !pWAP->m_bCredentialsDetected) { + m_pCookieDetectionFailedStaticCtrl->SetLabel( + _("Your web browser does not support automatic logon detection.\nPlease click on the 'Find logon information' link\nbelow to find out what to put in the email address and\npassword fields.") + ); + m_pCookieDetectionFailedCtrl->SetLabel( + _("Find logon information") + ); + m_pCookieDetectionFailedCtrl->SetURL( + pWAP->m_strCookieFailureURL + ); + } + if (pSkinAdvanced->IsBranded() && !pSkinWizardATAM->GetAccountInfoMessage().IsEmpty()) { m_pAccountInformationStaticCtrl->SetLabel( diff --git a/clientgui/AccountInfoPage.h b/clientgui/AccountInfoPage.h index 588e62c5c6..78435ae078 100644 --- a/clientgui/AccountInfoPage.h +++ b/clientgui/AccountInfoPage.h @@ -92,6 +92,8 @@ public: ////@begin CAccountInfoPage member variables wxStaticText* m_pTitleStaticCtrl; + wxStaticText* m_pCookieDetectionFailedStaticCtrl; + wxHyperLink* m_pCookieDetectionFailedCtrl; wxStaticText* m_pAccountQuestionStaticCtrl; wxRadioButton* m_pAccountCreateCtrl; wxRadioButton* m_pAccountUseExistingCtrl; diff --git a/clientgui/BOINCWizards.h b/clientgui/BOINCWizards.h index 6a8dd78057..3c273ba6f7 100644 --- a/clientgui/BOINCWizards.h +++ b/clientgui/BOINCWizards.h @@ -107,6 +107,7 @@ #define ID_ACCOUNTREQUIREMENTSSTATICCTRL 11408 #define ID_ACCOUNTLINKLABELSTATICCTRL 11409 #define ID_ACCOUNTFORGOTPASSWORDCTRL 11410 +#define ID_ACCOUNTCOOKIEDETECTIONFAILEDCTRL 11411 // Proxy Page Controls #define ID_PROXYHTTPSERVERSTATICCTRL 11500 diff --git a/clientgui/WizardAttachProject.cpp b/clientgui/WizardAttachProject.cpp index 9e4219abea..e47c2c12da 100644 --- a/clientgui/WizardAttachProject.cpp +++ b/clientgui/WizardAttachProject.cpp @@ -140,13 +140,15 @@ bool CWizardAttachProject::Create( wxWindow* parent, wxWindowID id, const wxPoin account_out.clear(); account_created_successfully = false; attached_to_project_successfully = false; - project_url = wxEmptyString; - project_authenticator = wxEmptyString; - project_name = wxEmptyString; + project_url.Empty(); + project_authenticator.Empty(); + project_name.Empty(); m_strProjectName.Empty(); m_strReturnURL.Empty(); m_bCredentialsCached = false; m_bCredentialsDetected = false; + m_bCookieRequired = false; + m_strCookieFailureURL.Empty(); CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced(); @@ -336,6 +338,8 @@ bool CWizardAttachProject::SyncToAccountManager() { m_AccountManagerInfoPage->SetProjectURL( wxString(ami.acct_mgr_url.c_str(), wxConvUTF8) ); m_strProjectName = wxString(ami.acct_mgr_name.c_str(), wxConvUTF8); m_bCredentialsCached = ami.have_credentials; + m_bCookieRequired = ami.cookie_required; + m_strCookieFailureURL = wxString(ami.cookie_failure_url.c_str(), wxConvUTF8); } if (ami.acct_mgr_url.size() && !m_bCredentialsCached) { diff --git a/clientgui/WizardAttachProject.h b/clientgui/WizardAttachProject.h index 640bb33c83..3522746fe2 100644 --- a/clientgui/WizardAttachProject.h +++ b/clientgui/WizardAttachProject.h @@ -138,6 +138,8 @@ public: bool m_bCredentialsDetected; wxString m_strProjectName; wxString m_strReturnURL; + bool m_bCookieRequired; + wxString m_strCookieFailureURL; }; #endif // _WIZ_ATTACHPROJECT_H_ diff --git a/lib/gui_rpc_client.h b/lib/gui_rpc_client.h index e4559789ed..809045ed41 100644 --- a/lib/gui_rpc_client.h +++ b/lib/gui_rpc_client.h @@ -437,6 +437,8 @@ struct ACCT_MGR_INFO { std::string acct_mgr_name; std::string acct_mgr_url; bool have_credentials; + bool cookie_required; + std::string cookie_failure_url; ACCT_MGR_INFO(); ~ACCT_MGR_INFO(){} diff --git a/lib/gui_rpc_client_ops.cpp b/lib/gui_rpc_client_ops.cpp index 539482e282..38a1f79776 100644 --- a/lib/gui_rpc_client_ops.cpp +++ b/lib/gui_rpc_client_ops.cpp @@ -825,6 +825,8 @@ int ACCT_MGR_INFO::parse(MIOFILE& in) { if (parse_str(buf, "", acct_mgr_name)) continue; if (parse_str(buf, "", acct_mgr_url)) continue; if (parse_bool(buf, "have_credentials", have_credentials)) continue; + if (parse_bool(buf, "cookie_required", cookie_required)) continue; + if (parse_str(buf, "", cookie_failure_url)) continue; } return ERR_XML_PARSE; } @@ -833,6 +835,8 @@ void ACCT_MGR_INFO::clear() { acct_mgr_name = ""; acct_mgr_url = ""; have_credentials = false; + cookie_required = false; + cookie_failure_url = ""; } ACCT_MGR_RPC_REPLY::ACCT_MGR_RPC_REPLY() {