From 48844aa4c7690e1e89122e016a3b1ceadca2fdc7 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Fri, 30 Jun 2023 11:34:52 -0500 Subject: [PATCH] Include a notice during account creation for under-18 users (#927) --- src/state/models/ui/create-account.ts | 10 +++++++++- src/view/com/auth/create/Policies.tsx | 11 +++++++++-- src/view/com/auth/create/Step2.tsx | 5 ++++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/state/models/ui/create-account.ts b/src/state/models/ui/create-account.ts index 78ffe885..d35b3557 100644 --- a/src/state/models/ui/create-account.ts +++ b/src/state/models/ui/create-account.ts @@ -31,13 +31,21 @@ export class CreateAccountModel { makeAutoObservable(this, {}, {autoBind: true}) } + get isAge13() { + return getAge(this.birthDate) >= 13 + } + + get isAge18() { + return getAge(this.birthDate) >= 18 + } + // form state controls // = next() { this.error = '' if (this.step === 2) { - if (getAge(this.birthDate) < 13) { + if (!this.isAge13) { this.error = 'Unfortunately, you do not meet the requirements to create an account.' return diff --git a/src/view/com/auth/create/Policies.tsx b/src/view/com/auth/create/Policies.tsx index 4ba6a540..a3943d8c 100644 --- a/src/view/com/auth/create/Policies.tsx +++ b/src/view/com/auth/create/Policies.tsx @@ -12,8 +12,10 @@ import {usePalette} from 'lib/hooks/usePalette' export const Policies = ({ serviceDescription, + needsGuardian, }: { serviceDescription: ServiceDescription + needsGuardian: boolean }) => { const pal = usePalette('default') if (!serviceDescription) { @@ -73,6 +75,12 @@ export const Policies = ({ By creating an account you agree to the {els}. + {needsGuardian && ( + + If you are not yet an adult according to the laws of your country, + your parent or legal guardian must read these Terms on your behalf. + + )} ) } @@ -85,8 +93,7 @@ function validWebLink(url?: string): string | undefined { const styles = StyleSheet.create({ policies: { - flexDirection: 'row', - alignItems: 'flex-start', + gap: 8, }, errorIcon: { borderWidth: 1, diff --git a/src/view/com/auth/create/Step2.tsx b/src/view/com/auth/create/Step2.tsx index 1e014f18..86338bbd 100644 --- a/src/view/com/auth/create/Step2.tsx +++ b/src/view/com/auth/create/Step2.tsx @@ -116,7 +116,10 @@ export const Step2 = observer(({model}: {model: CreateAccountModel}) => { {model.serviceDescription && ( - + )} )}