/*! * Runs the wizard. */ bool CWizardAttach::Run( wxString strProjectURL, bool bCredentialsCached ) { if (strProjectURL.Length()) { SetProjectURL(strProjectURL); SetCredentialsCached(bCredentialsCached); } // If credentials are not cached, then we should try one last place to look up the // authenticator. Some projects will set a "Setup" cookie off of their URL with a // pretty short timeout. Lets take a crack at detecting it. // if (!strProjectURL.IsEmpty() && !bCredentialsCached) { std::string url = std::string(strProjectURL.mb_str()); std::string authenticator; if (detect_setup_authenticator(url, authenticator)) { SetCredentialsDetected(true); SetCloseWhenCompleted(true); SetProjectAuthenticator(wxString(authenticator.c_str(), wxConvUTF8)); } } if (m_ProjectPropertiesPage || m_ProjectInfoPage) { IsAttachToProjectWizard = true; IsAccountManagerWizard = false; if (strProjectURL.Length()) { return RunWizard(m_ProjectPropertiesPage); } else { return RunWizard(m_ProjectInfoPage); } } return FALSE; }
bool CWizardAttach::SyncToAccountManager() { ACCT_MGR_INFO ami; CMainDocument* pDoc = wxGetApp().GetDocument(); wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); IsAttachToProjectWizard = false; IsAccountManagerWizard = true; pDoc->rpc.acct_mgr_info(ami); if (ami.acct_mgr_url.size()) { SetProjectName(wxString(ami.acct_mgr_name.c_str(), wxConvUTF8)); SetProjectURL(wxString(ami.acct_mgr_url.c_str(), wxConvUTF8)); SetCredentialsCached(ami.have_credentials); SetCookieRequired(ami.cookie_required); SetCookieFailureURL(wxString(ami.cookie_failure_url.c_str(), wxConvUTF8)); if (IsCredentialsCached()) { IsAccountManagerUpdateWizard = true; } } if (ami.acct_mgr_url.size() && !m_bCredentialsCached) { std::string login; std::string password_hash; std::string return_url; if (detect_account_manager_credentials(ami.acct_mgr_url, login, password_hash, return_url)) { wxString strLogin; wxString strPasswordHash; wxString strReturnURL; strLogin = wxURL::Unescape(wxString(login.c_str(), wxConvUTF8)); strPasswordHash = wxURL::Unescape(wxString(password_hash.c_str(), wxConvUTF8)); strReturnURL = wxURL::Unescape(wxString(return_url.c_str(), wxConvUTF8)); SetCredentialsDetected(true); SetReturnURL(strReturnURL); SetAccountEmailAddress(strLogin); SetAccountUsername(strLogin); SetAccountPassword( wxString(_T("hash:")) + strPasswordHash ); } } if (m_AccountManagerInfoPage || m_AccountManagerPropertiesPage) { IsAttachToProjectWizard = false; IsAccountManagerWizard = true; if (!ami.acct_mgr_url.size()) { return RunWizard(m_AccountManagerInfoPage); } else { return RunWizard(m_AccountManagerPropertiesPage); } } return FALSE; }
/*! * Runs the wizard. */ bool CWizardAttach::Run( wxString strProjectName, wxString strProjectURL, wxString strProjectAuthenticator, wxString strProjectInstitution, wxString strProjectDescription, wxString strProjectKnown, wxString strProjectSetupCookie, bool bAccountKeyDetected, bool bEmbedded ){ SetProjectName(strProjectName); if (strProjectURL.size()) { SetProjectURL(strProjectURL); SetCredentialsCached(bAccountKeyDetected); } SetProjectInstitution(strProjectInstitution); SetProjectDescription(strProjectDescription); if (strProjectAuthenticator.size()) { SetProjectAuthenticator(strProjectAuthenticator); } if (strProjectSetupCookie.size()) { SetProjectSetupCookie(strProjectSetupCookie); } SetProjectKnown(strProjectKnown.length() > 0); if (strProjectURL.size() && strProjectAuthenticator.size() && !bAccountKeyDetected) { SetCredentialsDetected(true); SetCloseWhenCompleted(true); } if (m_ProjectPropertiesPage && m_ProjectInfoPage && m_ProjectWelcomePage) { IsAttachToProjectWizard = true; IsAccountManagerWizard = false; if (strProjectName.size() && strProjectURL.size() && (strProjectSetupCookie.size() == 0)) { return RunWizard(m_ProjectWelcomePage); } else if (strProjectURL.size() && (IsCredentialsCached() || IsCredentialsDetected() || strProjectSetupCookie.size())) { return RunWizard(m_ProjectPropertiesPage); } else { return RunWizard(m_ProjectInfoPage); } } return FALSE; }