Skip to content

Commit

Permalink
client,mgr: pass on consent to terms to project
Browse files Browse the repository at this point in the history
Let the project know that the user consented to the project's terms of
use when a new account is created for the user. The project can record
the consent for GDPR compliance.
  • Loading branch information
JuhaSointusalo committed Nov 20, 2018
1 parent 5463a4d commit c5e4eca
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 5 deletions.
11 changes: 10 additions & 1 deletion client/acct_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
);
Expand Down
3 changes: 2 additions & 1 deletion client/acct_setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -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&);
};
Expand Down Expand Up @@ -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);
};

Expand Down
6 changes: 5 additions & 1 deletion client/gui_rpc_server_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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("<error>&lt;name&gt; must be set in &lt;exchange_versions&gt; before using &lt;consented_to_terms/&gt;</error>\n");
return;
}
grc.create_account_op.do_rpc(ai, grc.client_name);
grc.mfout.printf("<success/>\n");
}

Expand Down
1 change: 1 addition & 0 deletions clientgui/ProjectProcessingPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 5 additions & 1 deletion clientgui/TermsOfUsePage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -293,6 +296,7 @@ void CTermsOfUsePage::OnPageChanging( wxWizardExEvent& event ) {
} else {
SetCredentialsAlreadyAvailable(false);
}
pWA->SetConsentedToTerms(GetUserAgrees());
}
}

Expand Down
1 change: 1 addition & 0 deletions clientgui/WizardAttach.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 4 additions & 0 deletions clientgui/WizardAttach.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ class CWizardAttach: public CBOINCBaseWizard
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 ; }

Expand Down Expand Up @@ -374,6 +377,7 @@ class CWizardAttach: public CBOINCBaseWizard
wxString m_strAccountUsername;
wxString m_strAccountPassword;
wxString m_strAccountConfirmPassword;
bool m_bConsentedToTerms;
wxString m_strReturnURL;
wxString m_strCookieFailureURL;
};
Expand Down
1 change: 1 addition & 0 deletions lib/gui_rpc_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ struct ACCOUNT_IN {
std::string server_cookie;
bool ldap_auth;
bool server_assigned_cookie;
bool consented_to_terms;

ACCOUNT_IN();

Expand Down
5 changes: 4 additions & 1 deletion lib/gui_rpc_client_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -2377,12 +2378,14 @@ int RPC_CLIENT::create_account(ACCOUNT_IN& ai) {
" <passwd_hash>%s</passwd_hash>\n"
" <user_name>%s</user_name>\n"
" <team_name>%s</team_name>\n"
" %s"
"</create_account>\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 ? "<consented_to_terms/>\n" : ""
);
buf[sizeof(buf)-1] = 0;

Expand Down

0 comments on commit c5e4eca

Please sign in to comment.