Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(console,phrases): support agree to terms policy configuration #6037

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,19 +1,40 @@
import { useFormContext } from 'react-hook-form';
import { AgreeToTermsPolicy } from '@logto/schemas';
import { Controller, useFormContext } from 'react-hook-form';
import { useTranslation } from 'react-i18next';

import Card from '@/ds-components/Card';
import DynamicT from '@/ds-components/DynamicT';
import FormField from '@/ds-components/FormField';
import Select from '@/ds-components/Select';
import TextInput from '@/ds-components/TextInput';
import { uriValidator } from '@/utils/validator';

import type { SignInExperienceForm } from '../../types';
import FormSectionTitle from '../components/FormSectionTitle';

const agreeToTermsPolicyOptions = [
{
value: AgreeToTermsPolicy.Automatic,
title: <DynamicT forKey="sign_in_exp.content.terms_of_use.agree_policies.automatic" />,
},
{
value: AgreeToTermsPolicy.ManualRegistrationOnly,
title: (
<DynamicT forKey="sign_in_exp.content.terms_of_use.agree_policies.manual_registration_only" />
),
},
{
value: AgreeToTermsPolicy.Manual,
title: <DynamicT forKey="sign_in_exp.content.terms_of_use.agree_policies.manual" />,
},
];

function TermsForm() {
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
const {
register,
formState: { errors },
control,
} = useFormContext<SignInExperienceForm>();

return (
Expand All @@ -37,6 +58,16 @@ function TermsForm() {
placeholder={t('sign_in_exp.content.terms_of_use.privacy_policy_placeholder')}
/>
</FormField>
<FormField title="sign_in_exp.content.terms_of_use.agree_to_terms">
<Controller
name="agreeToTermsPolicy"
control={control}
rules={{ required: true }}
render={({ field: { onChange, value } }) => (
<Select options={agreeToTermsPolicyOptions} value={value} onChange={onChange} />
)}
/>
</FormField>
</Card>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ const content = {
terms_of_use_placeholder: 'https://your.terms.of.use/',
privacy_policy: 'Privacy policy URL',
privacy_policy_placeholder: 'https://your.privacy.policy/',
agree_to_terms: 'Den Bedingungen zustimmen',
agree_policies: {
automatic: 'Weiterhin automatisch den Bedingungen zustimmen',
manual_registration_only: 'Checkbox-Zustimmung nur bei der Registrierung erforderlich',
manual:
'Checkbox-Zustimmung sowohl bei der Registrierung als auch beim Anmelden erforderlich',
},
},
languages: {
title: 'LANGUAGES',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ const content = {
terms_of_use_placeholder: 'https://your.terms.of.use/',
privacy_policy: 'Privacy policy URL',
privacy_policy_placeholder: 'https://your.privacy.policy/',
agree_to_terms: 'Agree to terms',
agree_policies: {
automatic: 'Continue to automatically agree to terms',
manual_registration_only: 'Require checkbox agreement on registration only',
manual: 'Require checkbox agreement on both registration and sign-in',
},
},
languages: {
title: 'LANGUAGES',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ const content = {
terms_of_use_placeholder: 'https://your.terms.of.use/',
privacy_policy: 'Privacy policy URL',
privacy_policy_placeholder: 'https://your.privacy.policy/',
agree_to_terms: 'Aceptar los términos',
agree_policies: {
automatic: 'Continuar aceptando los términos automáticamente',
manual_registration_only:
'Requerir acuerdo con la casilla de verificación solo en el registro',
manual:
'Requerir acuerdo con la casilla de verificación tanto en el registro como al iniciar sesión',
},
},
languages: {
title: 'LANGUAGES',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ const content = {
terms_of_use_placeholder: 'https://your.terms.of.use/',
privacy_policy: 'Privacy policy URL',
privacy_policy_placeholder: 'https://your.privacy.policy/',
agree_to_terms: 'Accepter les conditions',
agree_policies: {
automatic: 'Continuer à accepter automatiquement les conditions',
manual_registration_only:
'Requérir l’accord par case à cocher uniquement lors de l’inscription',
manual:
'Requérir l’accord par case à cocher à la fois lors de l’inscription et de la connexion',
},
},
languages: {
title: 'LANGUAGES',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ const content = {
terms_of_use_placeholder: 'https://your.terms.of.use/',
privacy_policy: 'Privacy policy URL',
privacy_policy_placeholder: 'https://your.privacy.policy/',
agree_to_terms: 'Accettare i termini',
agree_policies: {
automatic: 'Continuare ad accettare automaticamente i termini',
manual_registration_only:
"Richiedere l'accordo della casella di controllo solo alla registrazione",
manual: "Richiedere l'accordo della casella di controllo sia alla registrazione che al login",
},
},
languages: {
title: 'LANGUAGES',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ const content = {
terms_of_use_placeholder: 'https://your.terms.of.use/',
privacy_policy: 'Privacy policy URL',
privacy_policy_placeholder: 'https://your.privacy.policy/',
agree_to_terms: '利用規約に同意する',
agree_policies: {
automatic: '自動的に利用規約に同意し続ける',
manual_registration_only: '登録時のみチェックボックスで同意を求める',
manual: '登録時およびサインイン時の両方でチェックボックスの同意を求める',
},
},
languages: {
title: 'LANGUAGES',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ const content = {
terms_of_use_placeholder: 'https://your.terms.of.use/',
privacy_policy: 'Privacy policy URL',
privacy_policy_placeholder: 'https://your.privacy.policy/',
agree_to_terms: '약관에 동의하기',
agree_policies: {
automatic: '자동으로 약관에 계속 동의하기',
manual_registration_only: '등록 시에만 체크박스 동의 요구',
manual: '등록 시와 로그인 시 모두 체크박스 동의 요구',
},
},
languages: {
title: 'LANGUAGES',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ const content = {
terms_of_use_placeholder: 'https://your.terms.of.use/',
privacy_policy: 'Privacy policy URL',
privacy_policy_placeholder: 'https://your.privacy.policy/',
agree_to_terms: 'Zgadzam się na warunki',
agree_policies: {
automatic: 'Kontynuuj automatyczne zgadzanie się na warunki',
manual_registration_only: 'Wymagaj zgody na warunki przy rejestracji',
manual: 'Wymagaj zgody na warunki przy rejestracji i logowaniu',
},
},
languages: {
title: 'LANGUAGES',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ const content = {
terms_of_use_placeholder: 'https://your.terms.of.use/',
privacy_policy: 'Privacy policy URL',
privacy_policy_placeholder: 'https://your.privacy.policy/',
agree_to_terms: 'Concordar com os termos',
agree_policies: {
automatic: 'Continuar concordando automaticamente com os termos',
manual_registration_only: 'Requerer concordância da caixa de seleção apenas no registro',
manual: 'Requerer concordância da caixa de seleção tanto no registro quanto no login',
},
},
languages: {
title: 'LANGUAGES',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ const content = {
terms_of_use_placeholder: 'https://your.terms.of.use/',
privacy_policy: 'Privacy policy URL',
privacy_policy_placeholder: 'https://your.privacy.policy/',
agree_to_terms: 'Aceitar os termos',
agree_policies: {
automatic: 'Continuar a aceitar automaticamente os termos',
manual_registration_only: 'Exigir aceitação da caixa de verificação apenas no registo',
manual: 'Exigir aceitação da caixa de verificação tanto no registo quanto no login',
},
},
languages: {
title: 'LANGUAGES',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ const content = {
terms_of_use_placeholder: 'https://your.terms.of.use/',
privacy_policy: 'Privacy policy URL',
privacy_policy_placeholder: 'https://your.privacy.policy/',
agree_to_terms: 'Согласиться с условиями',
agree_policies: {
automatic: 'Продолжить автоматически соглашаться с условиями',
manual_registration_only: 'Требовать согласия через галочку только при регистрации',
manual: 'Требовать согласия через галочку при регистрации и входе в систему',
},
},
languages: {
title: 'LANGUAGES',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ const content = {
terms_of_use_placeholder: 'https://your.terms.of.use/',
privacy_policy: 'Privacy policy URL',
privacy_policy_placeholder: 'https://your.privacy.policy/',
agree_to_terms: 'Şartları kabul et',
agree_policies: {
automatic: 'Şartları otomatik olarak kabul etmeye devam et',
manual_registration_only: 'Sadece kayıt sırasında onay kutusu ile onay gerektirir',
manual: 'Kayıt ve giriş sırasında onay kutusu ile onay gerektirir',
},
},
languages: {
title: 'LANGUAGES',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ const content = {
terms_of_use_placeholder: 'https://your.terms.of.use/',
privacy_policy: 'Privacy policy URL',
privacy_policy_placeholder: 'https://your.privacy.policy/',
agree_to_terms: '同意条款',
agree_policies: {
automatic: '继续自动同意条款',
manual_registration_only: '仅在注册时需要勾选同意',
manual: '在注册和登录时都需要勾选同意',
},
},
languages: {
title: 'LANGUAGES',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ const content = {
terms_of_use_placeholder: 'https://your.terms.of.use/',
privacy_policy: 'Privacy policy URL',
privacy_policy_placeholder: 'https://your.privacy.policy/',
agree_to_terms: '同意條款',
agree_policies: {
automatic: '繼續自動同意條款',
manual_registration_only: '只在註冊時要求勾選同意',
manual: '在註冊和登錄時都需要勾選同意',
},
},
languages: {
title: 'LANGUAGES',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ const content = {
terms_of_use_placeholder: 'https://your.terms.of.use/',
privacy_policy: 'Privacy policy URL',
privacy_policy_placeholder: 'https://your.privacy.policy/',
agree_to_terms: '同意條款',
agree_policies: {
automatic: '繼續自動同意條款',
manual_registration_only: '僅在註冊時需要勾選同意',
manual: '在註冊和登入時都需要勾選同意',
},
},
languages: {
title: 'LANGUAGES',
Expand Down
Loading