diff --git a/client/acct_setup.cpp b/client/acct_setup.cpp
index 0b2b5b1694..892f4513ed 100644
--- a/client/acct_setup.cpp
+++ b/client/acct_setup.cpp
@@ -46,6 +46,7 @@ void ACCOUNT_IN::parse(XML_PARSER& xp) {
server_cookie = "";
ldap_auth = false;
server_assigned_cookie = false;
+ consented_to_terms = false;
while (!xp.get_tag()) {
if (xp.parse_string("url", url)) continue;
@@ -56,6 +57,7 @@ void ACCOUNT_IN::parse(XML_PARSER& xp) {
if (xp.parse_string("server_cookie", server_cookie)) continue;
if (xp.parse_bool("ldap_auth", ldap_auth)) continue;
if (xp.parse_bool("server_assigned_cookie", server_assigned_cookie)) continue;
+ if (xp.parse_bool("consented_to_terms", consented_to_terms)) continue;
}
canonicalize_master_url(url);
}
@@ -152,7 +154,7 @@ void LOOKUP_ACCOUNT_OP::handle_reply(int http_op_retval) {
}
}
-int CREATE_ACCOUNT_OP::do_rpc(ACCOUNT_IN& ai) {
+int CREATE_ACCOUNT_OP::do_rpc(ACCOUNT_IN& ai, string rpc_client_name) {
int retval;
string url;
string parameter;
@@ -181,6 +183,13 @@ int CREATE_ACCOUNT_OP::do_rpc(ACCOUNT_IN& ai) {
escape_url(parameter);
url += parameter;
}
+
+ if (ai.consented_to_terms) {
+ parameter = rpc_client_name;
+ escape_url(parameter);
+ url += "&consent_flag=1&source=" + parameter;
+ }
+
retval = gui_http->do_rpc(
this, url.c_str(), CREATE_ACCOUNT_FILENAME, false
);
diff --git a/client/acct_setup.h b/client/acct_setup.h
index 3d4bf21b11..0046989bb9 100644
--- a/client/acct_setup.h
+++ b/client/acct_setup.h
@@ -33,6 +33,7 @@ struct ACCOUNT_IN {
std::string server_cookie;
bool ldap_auth;
bool server_assigned_cookie;
+ bool consented_to_terms;
void parse(XML_PARSER&);
};
@@ -72,7 +73,7 @@ struct CREATE_ACCOUNT_OP: public GUI_HTTP_OP {
gui_http = p;
}
virtual ~CREATE_ACCOUNT_OP(){}
- int do_rpc(ACCOUNT_IN&);
+ int do_rpc(ACCOUNT_IN&, std::string rpc_client_name);
virtual void handle_reply(int http_op_retval);
};
diff --git a/client/gui_rpc_server_ops.cpp b/client/gui_rpc_server_ops.cpp
index d099efb77b..f8d09b0202 100644
--- a/client/gui_rpc_server_ops.cpp
+++ b/client/gui_rpc_server_ops.cpp
@@ -830,7 +830,11 @@ void handle_create_account(GUI_RPC_CONN& grc) {
ACCOUNT_IN ai;
ai.parse(grc.xp);
- grc.create_account_op.do_rpc(ai);
+ if (ai.consented_to_terms && !grc.client_name.size()) {
+ grc.mfout.printf("<name> must be set in <exchange_versions> before using <consented_to_terms/>\n");
+ return;
+ }
+ grc.create_account_op.do_rpc(ai, grc.client_name);
grc.mfout.printf("\n");
}
diff --git a/clientgui/ProjectProcessingPage.cpp b/clientgui/ProjectProcessingPage.cpp
index c911cd5fb3..d7a95de72b 100644
--- a/clientgui/ProjectProcessingPage.cpp
+++ b/clientgui/ProjectProcessingPage.cpp
@@ -421,6 +421,7 @@ void CProjectProcessingPage::OnStateChange( CProjectProcessingPageEvent& WXUNUSE
if (pWA->m_AccountInfoPage->m_pAccountCreateCtrl->GetValue() && !pWA->GetProjectSetupCookie().size()) {
creating_account = true;
+ ai->consented_to_terms = pWA->GetConsentedToTerms();
// Wait until we are done processing the request.
dtStartExecutionTime = wxDateTime::Now();
diff --git a/clientgui/TermsOfUsePage.cpp b/clientgui/TermsOfUsePage.cpp
index 81eb54f696..6c386d050f 100644
--- a/clientgui/TermsOfUsePage.cpp
+++ b/clientgui/TermsOfUsePage.cpp
@@ -280,7 +280,10 @@ void CTermsOfUsePage::OnPageChanging( wxWizardExEvent& event ) {
// re-enabled if the back button is pressed.
pWA->EnableNextButton();
- if (event.GetDirection() == false) return;
+ if (event.GetDirection() == false) {
+ pWA->SetConsentedToTerms(false);
+ return;
+ }
if (!CHECK_CLOSINGINPROGRESS()) {
// We are leaving this page.
@@ -293,6 +296,7 @@ void CTermsOfUsePage::OnPageChanging( wxWizardExEvent& event ) {
} else {
SetCredentialsAlreadyAvailable(false);
}
+ pWA->SetConsentedToTerms(GetUserAgrees());
}
}
diff --git a/clientgui/WizardAttach.cpp b/clientgui/WizardAttach.cpp
index 9b9d28268d..718d75a190 100644
--- a/clientgui/WizardAttach.cpp
+++ b/clientgui/WizardAttach.cpp
@@ -140,6 +140,7 @@ bool CWizardAttach::Create( wxWindow* parent, wxWindowID id, const wxString& /*
m_bCredentialsDetected = false;
m_bCookieRequired = false;
m_strCookieFailureURL.Empty();
+ m_bConsentedToTerms = false;
CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
diff --git a/clientgui/WizardAttach.h b/clientgui/WizardAttach.h
index a07b8d0234..719bc41a94 100644
--- a/clientgui/WizardAttach.h
+++ b/clientgui/WizardAttach.h
@@ -301,6 +301,9 @@ public:
wxString GetAccountConfirmPassword() const { return m_strAccountConfirmPassword ; }
void SetAccountConfirmPassword(wxString value) { m_strAccountConfirmPassword = value ; }
+ bool GetConsentedToTerms() const { return m_bConsentedToTerms ; }
+ void SetConsentedToTerms(bool value) { m_bConsentedToTerms = value ; }
+
wxString GetReturnURL() const { return m_strReturnURL ; }
void SetReturnURL(wxString value) { m_strReturnURL = value ; }
@@ -374,6 +377,7 @@ public:
wxString m_strAccountUsername;
wxString m_strAccountPassword;
wxString m_strAccountConfirmPassword;
+ bool m_bConsentedToTerms;
wxString m_strReturnURL;
wxString m_strCookieFailureURL;
};
diff --git a/lib/gui_rpc_client.h b/lib/gui_rpc_client.h
index 3329bb6aad..69b699db6f 100644
--- a/lib/gui_rpc_client.h
+++ b/lib/gui_rpc_client.h
@@ -582,6 +582,7 @@ struct ACCOUNT_IN {
std::string server_cookie;
bool ldap_auth;
bool server_assigned_cookie;
+ bool consented_to_terms;
ACCOUNT_IN();
diff --git a/lib/gui_rpc_client_ops.cpp b/lib/gui_rpc_client_ops.cpp
index 7acc5f7673..3f1075511e 100644
--- a/lib/gui_rpc_client_ops.cpp
+++ b/lib/gui_rpc_client_ops.cpp
@@ -1384,6 +1384,7 @@ void ACCOUNT_IN::clear() {
server_cookie.clear();
ldap_auth = false;
server_assigned_cookie = false;
+ consented_to_terms = false;
}
ACCOUNT_OUT::ACCOUNT_OUT() {
@@ -2377,12 +2378,14 @@ int RPC_CLIENT::create_account(ACCOUNT_IN& ai) {
" %s\n"
" %s\n"
" %s\n"
+ " %s"
"\n",
ai.url.c_str(),
ai.email_addr.c_str(),
passwd_hash.c_str(),
ai.user_name.c_str(),
- ai.team_name.c_str()
+ ai.team_name.c_str(),
+ ai.consented_to_terms ? "\n" : ""
);
buf[sizeof(buf)-1] = 0;