[FIX] Missing Privacy Policy Agree on register (#15832)

* Add privacy policy agree to wizard and send it and missing fields in register

* Add error if registered and not agreed to terms

* send workspaceType

* Add test for privacy check and weird test to check inner checkbox

* Remove value=false for checkbox.  Completely un-needed, adjusted
selector.

Thanks for the feedback @tassoevan !
pull/15442/head
Aaron Ogle 6 years ago committed by Diego Sampaio
parent 1ccbd585f2
commit 376e37bfb6
  1. 13
      app/cloud/server/functions/startRegisterWorkspace.js
  2. 13
      app/cloud/server/functions/syncWorkspace.js
  3. 4
      app/lib/server/startup/settings.js
  4. 4
      client/components/setupWizard/steps/RegisterServerStep.css
  5. 22
      client/components/setupWizard/steps/RegisterServerStep.js
  6. 4
      packages/rocketchat-i18n/i18n/en.i18n.json
  7. 9
      tests/end-to-end/ui/00-login.js
  8. 4
      tests/pageobjects/setup-wizard.page.js

@ -41,8 +41,13 @@ export function startRegisterWorkspace(resend = false) {
const allowMarketing = settings.get('Allow_Marketing_Emails');
const accountName = settings.get('Organization_Name');
const website = settings.get('Website');
const agreePrivacyTerms = settings.get('Cloud_Service_Agree_PrivacyTerms');
const { organizationType, industry, size: orgSize, country, language, serverType: workspaceType } = stats.wizard;
const regInfo = {
uniqueId: stats.uniqueId,
workspaceId,
@ -51,11 +56,19 @@ export function startRegisterWorkspace(resend = false) {
contactEmail,
allowMarketing,
accountName,
organizationType,
industry,
orgSize,
country,
language,
agreePrivacyTerms,
website,
siteName,
workspaceType,
deploymentMethod: stats.deploy.method,
deploymentPlatform: stats.deploy.platform,
version: stats.version,
setupComplete: true,
};
const cloudUrl = settings.get('Cloud_Url');

@ -18,14 +18,27 @@ export function syncWorkspace(reconnectCheck = false) {
const address = settings.get('Site_Url');
const siteName = settings.get('Site_Name');
const website = settings.get('Website');
const setupComplete = settings.get('Show_Setup_Wizard') === 'completed';
const { organizationType, industry, size: orgSize, country, language, serverType: workspaceType } = stats.wizard;
const info = {
uniqueId: stats.uniqueId,
address,
siteName,
website,
organizationType,
industry,
orgSize,
country,
language,
workspaceType,
deploymentMethod: stats.deploy.method,
deploymentPlatform: stats.deploy.platform,
version: stats.version,
setupComplete,
};
const workspaceUrl = settings.get('Cloud_Workspace_Registration_Client_Uri');

@ -2646,6 +2646,10 @@ settings.addGroup('Setup_Wizard', function() {
secret: true,
});
this.add('Cloud_Service_Agree_PrivacyTerms', false, {
type: 'boolean',
});
this.add('Cloud_Workspace_Id', '', {
type: 'string',
hidden: true,

@ -13,6 +13,10 @@
.SetupWizard__RegisterServerStep-content {
display: flex;
flex-direction: column;
& > .SetupWizard__RegisterServerStep__PrivacyTerms {
margin-top: 1rem;
}
}
.SetupWizard__RegisterServerStep-option.SetupWizard__RegisterServerStep-option {

@ -51,6 +51,7 @@ export function RegisterServerStep({ step, title, active }) {
const [registerServer, setRegisterServer] = useState(true);
const [optInMarketingEmails, setOptInMarketingEmails] = useState(true);
const [agreeTermsAndPrivacy, setAgreeTermsAndPrivacy] = useState(false);
const t = useTranslation();
@ -70,6 +71,10 @@ export function RegisterServerStep({ step, title, active }) {
setComitting(true);
try {
if (registerServer && !agreeTermsAndPrivacy) {
throw new Object({ error: 'Register_Server_Terms_Alert' });
}
await batchSetSettings([
{
_id: 'Statistics_reporting',
@ -87,6 +92,10 @@ export function RegisterServerStep({ step, title, active }) {
_id: 'Allow_Marketing_Emails',
value: optInMarketingEmails,
},
{
_id: 'Cloud_Service_Agree_PrivacyTerms',
value: agreeTermsAndPrivacy,
},
]);
if (registerServer) {
@ -149,6 +158,7 @@ export function RegisterServerStep({ step, title, active }) {
onChange={({ currentTarget: { checked } }) => {
setRegisterServer(!checked);
setOptInMarketingEmails(!checked);
setAgreeTermsAndPrivacy(!checked);
}}
>
<Items>
@ -157,6 +167,18 @@ export function RegisterServerStep({ step, title, active }) {
<Item icon='circle'>{t('Register_Server_Standalone_Own_Certificates')}</Item>
</Items>
</Option>
<Label text={<>{t('Register_Server_Registered_I_Agree')} <a href='https://rocket.chat/terms'>{t('Terms')}</a> & <a href='https://rocket.chat/privacy'>{t('Privacy_Policy')}</a></>} position='end' className='SetupWizard__RegisterServerStep__PrivacyTerms'>
<CheckBox
name='agreeTermsAndPrivacy'
data-qa-agree-terms
disabled={!registerServer}
checked={agreeTermsAndPrivacy}
onChange={({ currentTarget: { checked } }) => {
setAgreeTermsAndPrivacy(checked);
}}
/>
</Label>
</div>
</StepContent>

@ -2494,6 +2494,7 @@
"Previous_month": "Previous Month",
"Previous_week": "Previous Week",
"Privacy": "Privacy",
"Privacy_Policy": "Privacy Policy",
"Private": "Private",
"Private_Channel": "Private Channel",
"Private_Group": "Private Group",
@ -2591,6 +2592,8 @@
"Register_Server_Standalone_Service_Providers": "Create accounts with service providers",
"Register_Server_Standalone_Update_Settings": "Update the preconfigured settings",
"Register_Server_Standalone_Own_Certificates": "Recompile the mobile apps with your own certificates",
"Register_Server_Registered_I_Agree": "I agree with the",
"Register_Server_Terms_Alert": "Please agree to terms to complete registration",
"Registration": "Registration",
"Registration_Succeeded": "Registration Succeeded",
"Registration_via_Admin": "Registration via Admin",
@ -3016,6 +3019,7 @@
"Technology_Provider": "Technology Provider",
"Technology_Services": "Technology Services",
"Telecom": "Telecom",
"Terms": "Terms",
"Test_Connection": "Test Connection",
"Test_Desktop_Notifications": "Test Desktop Notifications",
"Texts": "Texts",

@ -134,6 +134,15 @@ describe('[Setup Wizard]', () => {
setupWizard.registeredServer.isSelected().should.be.true;
});
it('it should check if agree to privacy policy is false', () => {
setupWizard.serviceTermsAndPrivacyPolicyCheckbox.isSelected().should.be.false;
});
it('it should click agree to privacy policy and check if true', () => {
setupWizard.serviceTermsAndPrivacyPolicy.click();
setupWizard.serviceTermsAndPrivacyPolicyCheckbox.isSelected().should.be.true;
});
after(() => {
setupWizard.goNext();
});

@ -29,6 +29,10 @@ class SetupWizard extends Page {
get standaloneServer() { return browser.element('input[name="registerServer"][value="false"]'); }
get serviceTermsAndPrivacyPolicy() { return browser.element('[data-qa-agree-terms]').$('..'); }
get serviceTermsAndPrivacyPolicyCheckbox() { return browser.element('[data-qa-agree-terms]'); }
login() {
browser.execute(function(email, password) {
Meteor.loginWithPassword(email, password, () => {});

Loading…
Cancel
Save