fix age bypass
This commit is contained in:
@@ -1,17 +1,22 @@
|
||||
diff --git a/src/ageAssurance/index.tsx b/src/ageAssurance/index.tsx
|
||||
index 9a0a9c9d5..5a6563e52 100644
|
||||
--- a/src/ageAssurance/index.tsx
|
||||
+++ b/src/ageAssurance/index.tsx
|
||||
@@ -88,19 +88,16 @@ function InnerProvider({children}: {children: React.ReactNode}) {
|
||||
@@ -90,25 +90,16 @@ function InnerProvider({children}: {children: React.ReactNode}) {
|
||||
return (
|
||||
<AgeAssuranceStateContext.Provider
|
||||
value={useMemo(() => {
|
||||
- const chatDisabled = state.access !== AgeAssuranceAccess.Full
|
||||
- const isUnderage = data?.birthdate
|
||||
- ? isUserUnderAdultAge(data.birthdate)
|
||||
- const isUnderAdultAge = data?.birthdate
|
||||
- ? isUnderAge(data.birthdate, 18)
|
||||
- : true
|
||||
- const isOverRegionMinAccessAge = data?.birthdate
|
||||
- ? !isUnderAge(data.birthdate, config.minAccessAge)
|
||||
- : false
|
||||
- const isOverAppMinAccessAge = data?.birthdate
|
||||
- ? !isUnderAge(data.birthdate, MIN_ACCESS_AGE)
|
||||
- : false
|
||||
- const adultContentDisabled =
|
||||
- state.access !== AgeAssuranceAccess.Full || isUnderage
|
||||
- state.access !== AgeAssuranceAccess.Full || isUnderAdultAge
|
||||
return {
|
||||
Access: AgeAssuranceAccess,
|
||||
Status: AgeAssuranceStatus,
|
||||
@@ -23,8 +28,12 @@ index 9a0a9c9d5..5a6563e52 100644
|
||||
flags: {
|
||||
- adultContentDisabled,
|
||||
- chatDisabled,
|
||||
- isOverRegionMinAccessAge,
|
||||
- isOverAppMinAccessAge,
|
||||
+ adultContentDisabled: false,
|
||||
+ chatDisabled: false,
|
||||
+ isOverRegionMinAccessAge: true,
|
||||
+ isOverAppMinAccessAge: true,
|
||||
},
|
||||
}
|
||||
}, [state, data])}>
|
||||
}, [state, data, config])}>
|
||||
|
||||
@@ -1,23 +1,37 @@
|
||||
diff --git a/src/screens/Signup/StepInfo/index.tsx b/src/screens/Signup/StepInfo/index.tsx
|
||||
--- a/src/screens/Signup/StepInfo/index.tsx
|
||||
+++ b/src/screens/Signup/StepInfo/index.tsx
|
||||
@@ -7,11 +7,9 @@
|
||||
|
||||
import {isEmailMaybeInvalid} from '#/lib/strings/email'
|
||||
@@ -9,44 +9,17 @@
|
||||
import {logger} from '#/logger'
|
||||
-import {is13, is18, useSignupContext} from '#/screens/Signup/state'
|
||||
+import {useSignupContext} from '#/screens/Signup/state'
|
||||
import {Policies} from '#/screens/Signup/StepInfo/Policies'
|
||||
import {isNative} from '#/platform/detection'
|
||||
import {useSignupContext} from '#/screens/Signup/state'
|
||||
-import {Policies} from '#/screens/Signup/StepInfo/Policies'
|
||||
import {atoms as a, native} from '#/alf'
|
||||
-import * as Admonition from '#/components/Admonition'
|
||||
-import * as Dialog from '#/components/Dialog'
|
||||
-import {DeviceLocationRequestDialog} from '#/components/dialogs/DeviceLocationRequestDialog'
|
||||
-import * as DateField from '#/components/forms/DateField'
|
||||
-import {type DateFieldRef} from '#/components/forms/DateField/types'
|
||||
import {FormError} from '#/components/forms/FormError'
|
||||
import {HostingProvider} from '#/components/forms/HostingProvider'
|
||||
import * as TextField from '#/components/forms/TextField'
|
||||
@@ -22,16 +20,6 @@
|
||||
import {Envelope_Stroke2_Corner0_Rounded as Envelope} from '#/components/icons/Envelope'
|
||||
import {Lock_Stroke2_Corner0_Rounded as Lock} from '#/components/icons/Lock'
|
||||
import {Ticket_Stroke2_Corner0_Rounded as Ticket} from '#/components/icons/Ticket'
|
||||
-import {createStaticClick, SimpleInlineLinkText} from '#/components/Link'
|
||||
import {Loader} from '#/components/Loader'
|
||||
import {usePreemptivelyCompleteActivePolicyUpdate} from '#/components/PolicyUpdateOverlay/usePreemptivelyCompleteActivePolicyUpdate'
|
||||
-import * as Toast from '#/components/Toast'
|
||||
-import {
|
||||
- isUnderAge,
|
||||
- MIN_ACCESS_AGE,
|
||||
- useAgeAssuranceRegionConfigWithFallback,
|
||||
-} from '#/ageAssurance/util'
|
||||
-import {
|
||||
- useDeviceGeolocationApi,
|
||||
- useIsDeviceGeolocationGranted,
|
||||
-} from '#/geolocation'
|
||||
import {BackNextButtons} from '../BackNextButtons'
|
||||
|
||||
|
||||
-function sanitizeDate(date: Date): Date {
|
||||
- if (!date || date.toString() === 'Invalid Date') {
|
||||
- logger.error(`Create account: handled invalid date for birthDate`, {
|
||||
@@ -31,26 +45,40 @@ diff --git a/src/screens/Signup/StepInfo/index.tsx b/src/screens/Signup/StepInfo
|
||||
export function StepInfo({
|
||||
onPressBack,
|
||||
isServerError,
|
||||
@@ -55,7 +43,6 @@
|
||||
|
||||
@@ -70,21 +43,6 @@
|
||||
|
||||
const emailInputRef = useRef<TextInput>(null)
|
||||
const passwordInputRef = useRef<TextInput>(null)
|
||||
- const birthdateInputRef = useRef<DateFieldRef>(null)
|
||||
|
||||
-
|
||||
- const aaRegionConfig = useAgeAssuranceRegionConfigWithFallback()
|
||||
- const {setDeviceGeolocation} = useDeviceGeolocationApi()
|
||||
- const locationControl = Dialog.useDialogControl()
|
||||
- const isOverRegionMinAccessAge = state.dateOfBirth
|
||||
- ? !isUnderAge(state.dateOfBirth.toISOString(), aaRegionConfig.minAccessAge)
|
||||
- : true
|
||||
- const isOverAppMinAccessAge = state.dateOfBirth
|
||||
- ? !isUnderAge(state.dateOfBirth.toISOString(), MIN_ACCESS_AGE)
|
||||
- : true
|
||||
- const isOverMinAdultAge = state.dateOfBirth
|
||||
- ? !isUnderAge(state.dateOfBirth.toISOString(), 18)
|
||||
- : true
|
||||
- const isDeviceGeolocationGranted = useIsDeviceGeolocationGranted()
|
||||
|
||||
const [hasWarnedEmail, setHasWarnedEmail] = React.useState<boolean>(false)
|
||||
|
||||
@@ -76,10 +63,6 @@
|
||||
|
||||
@@ -105,10 +63,6 @@
|
||||
const emailChanged = prevEmailValueRef.current !== email
|
||||
const password = passwordValueRef.current
|
||||
|
||||
- if (!is13(state.dateOfBirth)) {
|
||||
|
||||
- if (!isOverRegionMinAccessAge) {
|
||||
- return
|
||||
- }
|
||||
-
|
||||
if (state.serviceDescription?.inviteCodeRequired && !inviteCode) {
|
||||
return dispatch({
|
||||
type: 'setError',
|
||||
@@ -246,44 +229,21 @@
|
||||
@@ -275,107 +229,16 @@
|
||||
secureTextEntry
|
||||
autoComplete="new-password"
|
||||
autoCapitalize="none"
|
||||
@@ -83,18 +111,79 @@ diff --git a/src/screens/Signup/StepInfo/index.tsx b/src/screens/Signup/StepInfo
|
||||
- maximumDate={new Date()}
|
||||
- />
|
||||
- </View>
|
||||
<Policies
|
||||
serviceDescription={state.serviceDescription}
|
||||
- needsGuardian={!is18(state.dateOfBirth)}
|
||||
- under13={!is13(state.dateOfBirth)}
|
||||
+ needsGuardian={false}
|
||||
+ under13={false}
|
||||
/>
|
||||
-
|
||||
- <View style={[a.gap_sm]}>
|
||||
- <Policies serviceDescription={state.serviceDescription} />
|
||||
-
|
||||
- {!isOverRegionMinAccessAge || !isOverAppMinAccessAge ? (
|
||||
- <Admonition.Outer type="error">
|
||||
- <Admonition.Row>
|
||||
- <Admonition.Icon />
|
||||
- <Admonition.Content>
|
||||
- <Admonition.Text>
|
||||
- {!isOverAppMinAccessAge ? (
|
||||
- <Trans>
|
||||
- You must be {MIN_ACCESS_AGE} years of age or older
|
||||
- to create an account.
|
||||
- </Trans>
|
||||
- ) : (
|
||||
- <Trans>
|
||||
- You must be {aaRegionConfig.minAccessAge} years of
|
||||
- age or older to create an account in your region.
|
||||
- </Trans>
|
||||
- )}
|
||||
- </Admonition.Text>
|
||||
- {isNative &&
|
||||
- !isDeviceGeolocationGranted &&
|
||||
- isOverAppMinAccessAge && (
|
||||
- <Admonition.Text>
|
||||
- <Trans>
|
||||
- Have we got your location wrong?{' '}
|
||||
- <SimpleInlineLinkText
|
||||
- label={_(
|
||||
- msg`Tap here to confirm your location with GPS.`,
|
||||
- )}
|
||||
- {...createStaticClick(() => {
|
||||
- locationControl.open()
|
||||
- })}>
|
||||
- Tap here to confirm your location with GPS.
|
||||
- </SimpleInlineLinkText>
|
||||
- </Trans>
|
||||
- </Admonition.Text>
|
||||
- )}
|
||||
- </Admonition.Content>
|
||||
- </Admonition.Row>
|
||||
- </Admonition.Outer>
|
||||
- ) : !isOverMinAdultAge ? (
|
||||
- <Admonition.Admonition type="warning">
|
||||
- <Trans>
|
||||
- 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.
|
||||
- </Trans>
|
||||
- </Admonition.Admonition>
|
||||
- ) : undefined}
|
||||
- </View>
|
||||
-
|
||||
- {isNative && (
|
||||
- <DeviceLocationRequestDialog
|
||||
- control={locationControl}
|
||||
- onLocationAcquired={props => {
|
||||
- props.closeDialog(() => {
|
||||
- // set this after close!
|
||||
- setDeviceGeolocation(props.geolocation)
|
||||
- Toast.show(_(msg`Your location has been updated.`), {
|
||||
- type: 'success',
|
||||
- })
|
||||
- })
|
||||
- }}
|
||||
- />
|
||||
- )}
|
||||
</>
|
||||
) : undefined}
|
||||
</View>
|
||||
<BackNextButtons
|
||||
- hideNext={!is13(state.dateOfBirth)}
|
||||
- hideNext={!isOverRegionMinAccessAge}
|
||||
+ hideNext={false}
|
||||
showRetry={isServerError}
|
||||
isLoading={state.isLoading}
|
||||
|
||||
Reference in New Issue
Block a user