fix: Login Terms custom content (#28999)

pull/29415/head^2
Hugo Costa 3 years ago committed by GitHub
parent 9959bc6784
commit ebbb608166
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      .changeset/login-terms.md
  2. 1
      apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json
  3. 3
      apps/meteor/packages/rocketchat-i18n/i18n/pt-BR.i18n.json
  4. 15
      apps/meteor/server/settings/layout.ts
  5. 1
      apps/meteor/server/startup/migrations/index.ts
  6. 21
      apps/meteor/server/startup/migrations/v296.ts
  7. 15
      packages/web-ui-registration/src/components/LoginTerms.tsx

@ -0,0 +1,7 @@
---
"@rocket.chat/meteor": patch
"@rocket.chat/web-ui-registration": patch
---
fix: Login Terms custom content
The custom layout Login Terms did not had any effect on the login screen, so it was changed to get the proper setting effect

@ -2815,6 +2815,7 @@
"Layout_Home_Title": "Home Title",
"Layout_Legal_Notice": "Legal Notice",
"Layout_Login_Terms": "Login Terms",
"Layout_Login_Terms_Content": "By proceeding you are agreeing to our <a href='terms-of-service'>Terms of Service</a>, <a href='privacy-policy'>Privacy Policy</a> and <a href='legal-notice'>Legal Notice</a>.",
"Layout_Privacy_Policy": "Privacy Policy",
"Layout_Show_Home_Button": "Show home page button on sidebar header",
"Layout_Custom_Content_Description": "Here goes your custom content. It may be placed inside a white block or may take the all space available in the homepage, if you’re on Enterprise.",

@ -2478,6 +2478,7 @@
"Layout_Home_Title": "Título da página inicial",
"Layout_Legal_Notice": "Aviso legal",
"Layout_Login_Terms": "Termos de login",
"Layout_Login_Terms_Content": "Ao continuar você está concordando com nossos <a href='terms-of-service'>Termos de Serviço</a>, <a href='privacy-policy'>Política de Privacidade</a> e <a href='legal-notice'>Aviso Legal</a>.",
"Layout_Privacy_Policy": "Política de privacidade",
"Layout_Show_Home_Button": "Exibir \"Botão da página inicial\"",
"Layout_Sidenav_Footer": "Rodapé da navegação lateral",
@ -4985,4 +4986,4 @@
"RegisterWorkspace_Features_Omnichannel_Title": "Omnichannel",
"RegisterWorkspace_Setup_Label": "E-mail da conta da nuvem",
"cloud.RegisterWorkspace_Setup_Terms_Privacy": "Eu concordo com os <1>Termos e condições</1> e a <3>Política de privacidade</3>"
}
}

@ -108,15 +108,12 @@ export const createLayoutSettings = () =>
multiline: true,
public: true,
});
await this.add(
'Layout_Login_Terms',
'By proceeding you are agreeing to our <a href="terms-of-service">Terms of Service</a>, <a href="privacy-policy">Privacy Policy</a> and <a href="legal-notice">Legal Notice</a>.',
{
type: 'string',
multiline: true,
public: true,
},
);
await this.add('Layout_Login_Terms', '', {
type: 'code',
code: 'text/html',
multiline: true,
public: true,
});
await this.add('Layout_Privacy_Policy', 'Privacy Policy <br> Go to APP SETTINGS &rarr; Layout to customize this page.', {
type: 'code',
code: 'text/html',

@ -29,4 +29,5 @@ import './v292';
import './v293';
import './v294';
import './v295';
import './v296';
import './xrun';

@ -0,0 +1,21 @@
import { Settings } from '@rocket.chat/models';
import { addMigration } from '../../lib/migrations';
import { SystemLogger } from '../../lib/logger/system';
import { settings } from '../../../app/settings/server';
addMigration({
version: 296,
name: 'Reset the default value of Login Terms setting and replace by empty string',
async up() {
const oldLoginTermsValue =
'By proceeding you are agreeing to our <a href="terms-of-service">Terms of Service</a>, <a href="privacy-policy">Privacy Policy</a> and <a href="legal-notice">Legal Notice</a>.';
const loginTermsValue = settings.get('Layout_Login_Terms');
if (loginTermsValue === oldLoginTermsValue) {
await Settings.updateOne({ _id: 'Layout_Login_Terms' }, { $set: { value: '', packageValue: '' } });
SystemLogger.warn(`The default value of the setting 'Login Terms' has changed to an empty string. Please review your settings.`);
}
},
});

@ -1,15 +1,16 @@
import { Trans } from 'react-i18next';
import type { ReactElement } from 'react';
import { Link, HorizontalWizardLayoutCaption } from '@rocket.chat/layout';
import { HorizontalWizardLayoutCaption } from '@rocket.chat/layout';
import { useSetting } from '@rocket.chat/ui-contexts';
import { Box } from '@rocket.chat/fuselage';
import { useTranslation } from 'react-i18next';
export const LoginTerms = (): ReactElement => {
const { t } = useTranslation();
const loginTerms = useSetting('Layout_Login_Terms') as string;
return (
<HorizontalWizardLayoutCaption>
<Trans
defaults='By proceeding you are agreeing to our <0>{{terms}}</0>, <1>{{privacyPolicy}}</1> and <2>{{legalNotice}}</2>.'
values={{ terms: 'Terms of Service', privacyPolicy: 'Privacy Policy', legalNotice: 'Legal Notice' }}
components={[<Link href='/terms-of-service' />, <Link href='/privacy-policy' />, <Link href='/legal-notice' />]}
/>
<Box withRichContent dangerouslySetInnerHTML={{ __html: loginTerms !== '' ? loginTerms : t('Layout_Login_Terms_Content') }} />
</HorizontalWizardLayoutCaption>
);
};

Loading…
Cancel
Save