Compare commits

...

6 Commits

Author SHA1 Message Date
Hailey 96e2966c26 tweak 2024-11-15 17:27:47 -08:00
Hailey d6f2d70c38 interpolate 2024-11-15 17:25:47 -08:00
Hailey 70d2798724 log 2024-11-15 17:19:20 -08:00
Hailey 49f2be9178 set date 2024-11-15 17:18:22 -08:00
Hailey 3eb47cb044 fix self host 2024-11-15 17:10:01 -08:00
Hailey e8f6a5579b wording tweaks 2024-11-15 17:05:20 -08:00
2 changed files with 59 additions and 24 deletions
+45 -22
View File
@@ -146,18 +146,17 @@ export function Inner({
<ErrorMessage message={error} />
</View>
) : null}
<Text style={[a.text_md, a.leading_snug]}>
{currentStep === 'StepOne' ? (
<>
{!reasonText ? (
<>
<Trans>
You'll receive an email at{' '}
<Text style={[a.text_md, a.leading_snug, a.font_bold]}>
{currentAccount?.email}
</Text>{' '}
to verify it's you.
</Trans>{' '}
{currentStep === 'StepOne' ? (
<View>
{reasonText ? (
<View style={[a.gap_sm]}>
<Text style={[a.text_md, a.leading_snug]}>{reasonText}</Text>
<Text style={[a.text_md, a.leading_snug]}>
Don't have access to{' '}
<Text style={[a.text_md, a.leading_snug, a.font_bold]}>
{currentAccount?.email}
</Text>
?{' '}
<InlineLinkText
to="#"
label={_(msg`Change email address`)}
@@ -169,17 +168,41 @@ export function Inner({
})
return false
}}>
<Trans>Need to change it?</Trans>
<Trans>Change your email address</Trans>
</InlineLinkText>
</>
) : (
reasonText
)}
</>
) : (
uiStrings[currentStep].message
)}
</Text>
.
</Text>
</View>
) : (
<Text style={[a.text_md, a.leading_snug]}>
<Trans>
You'll receive an email at{' '}
<Text style={[a.text_md, a.leading_snug, a.font_bold]}>
{currentAccount?.email}
</Text>{' '}
to verify it's you.
</Trans>{' '}
<InlineLinkText
to="#"
label={_(msg`Change email address`)}
style={[a.text_md, a.leading_snug]}
onPress={e => {
e.preventDefault()
control.close(() => {
openModal({name: 'change-email'})
})
return false
}}>
<Trans>Need to change it?</Trans>
</InlineLinkText>
</Text>
)}
</View>
) : (
<Text style={[a.text_md, a.leading_snug]}>
{uiStrings[currentStep].message}
</Text>
)}
</View>
{currentStep === 'StepTwo' ? (
<View>
+14 -2
View File
@@ -1,4 +1,5 @@
import {useServiceConfigQuery} from '#/state/queries/email-verification-required'
import {useProfileQuery} from '#/state/queries/profile'
import {useSession} from '#/state/session'
import {BSKY_SERVICE} from '../constants'
import {getHostnameFromUrl} from '../strings/url-helpers'
@@ -7,13 +8,24 @@ export function useEmail() {
const {currentAccount} = useSession()
const {data: serviceConfig} = useServiceConfigQuery()
const {data: profile} = useProfileQuery({did: currentAccount?.did})
const checkEmailConfirmed = !!serviceConfig?.checkEmailConfirmed
const isNewEnough =
!!profile?.createdAt &&
Date.parse(profile.createdAt) >= Date.parse('2024-11-16T02:00:00.000Z')
const isSelfHost =
serviceConfig?.checkEmailConfirmed &&
currentAccount &&
getHostnameFromUrl(currentAccount.service) !==
getHostnameFromUrl(BSKY_SERVICE)
const needsEmailVerification = !isSelfHost && !currentAccount?.emailConfirmed
const needsEmailVerification =
!isSelfHost &&
checkEmailConfirmed &&
!!currentAccount?.emailConfirmed &&
isNewEnough
return {needsEmailVerification}
}