Tweak email verification dialog (#6397)
This commit is contained in:
@@ -146,18 +146,17 @@ export function Inner({
|
|||||||
<ErrorMessage message={error} />
|
<ErrorMessage message={error} />
|
||||||
</View>
|
</View>
|
||||||
) : null}
|
) : null}
|
||||||
<Text style={[a.text_md, a.leading_snug]}>
|
{currentStep === 'StepOne' ? (
|
||||||
{currentStep === 'StepOne' ? (
|
<View>
|
||||||
<>
|
{reasonText ? (
|
||||||
{!reasonText ? (
|
<View style={[a.gap_sm]}>
|
||||||
<>
|
<Text style={[a.text_md, a.leading_snug]}>{reasonText}</Text>
|
||||||
<Trans>
|
<Text style={[a.text_md, a.leading_snug]}>
|
||||||
You'll receive an email at{' '}
|
Don't have access to{' '}
|
||||||
<Text style={[a.text_md, a.leading_snug, a.font_bold]}>
|
<Text style={[a.text_md, a.leading_snug, a.font_bold]}>
|
||||||
{currentAccount?.email}
|
{currentAccount?.email}
|
||||||
</Text>{' '}
|
</Text>
|
||||||
to verify it's you.
|
?{' '}
|
||||||
</Trans>{' '}
|
|
||||||
<InlineLinkText
|
<InlineLinkText
|
||||||
to="#"
|
to="#"
|
||||||
label={_(msg`Change email address`)}
|
label={_(msg`Change email address`)}
|
||||||
@@ -169,17 +168,41 @@ export function Inner({
|
|||||||
})
|
})
|
||||||
return false
|
return false
|
||||||
}}>
|
}}>
|
||||||
<Trans>Need to change it?</Trans>
|
<Trans>Change your email address</Trans>
|
||||||
</InlineLinkText>
|
</InlineLinkText>
|
||||||
</>
|
.
|
||||||
) : (
|
</Text>
|
||||||
reasonText
|
</View>
|
||||||
)}
|
) : (
|
||||||
</>
|
<Text style={[a.text_md, a.leading_snug]}>
|
||||||
) : (
|
<Trans>
|
||||||
uiStrings[currentStep].message
|
You'll receive an email at{' '}
|
||||||
)}
|
<Text style={[a.text_md, a.leading_snug, a.font_bold]}>
|
||||||
</Text>
|
{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>
|
</View>
|
||||||
{currentStep === 'StepTwo' ? (
|
{currentStep === 'StepTwo' ? (
|
||||||
<View>
|
<View>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import {useServiceConfigQuery} from '#/state/queries/email-verification-required'
|
import {useServiceConfigQuery} from '#/state/queries/email-verification-required'
|
||||||
|
import {useProfileQuery} from '#/state/queries/profile'
|
||||||
import {useSession} from '#/state/session'
|
import {useSession} from '#/state/session'
|
||||||
import {BSKY_SERVICE} from '../constants'
|
import {BSKY_SERVICE} from '../constants'
|
||||||
import {getHostnameFromUrl} from '../strings/url-helpers'
|
import {getHostnameFromUrl} from '../strings/url-helpers'
|
||||||
@@ -7,13 +8,24 @@ export function useEmail() {
|
|||||||
const {currentAccount} = useSession()
|
const {currentAccount} = useSession()
|
||||||
|
|
||||||
const {data: serviceConfig} = useServiceConfigQuery()
|
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 =
|
const isSelfHost =
|
||||||
serviceConfig?.checkEmailConfirmed &&
|
|
||||||
currentAccount &&
|
currentAccount &&
|
||||||
getHostnameFromUrl(currentAccount.service) !==
|
getHostnameFromUrl(currentAccount.service) !==
|
||||||
getHostnameFromUrl(BSKY_SERVICE)
|
getHostnameFromUrl(BSKY_SERVICE)
|
||||||
const needsEmailVerification = !isSelfHost && !currentAccount?.emailConfirmed
|
|
||||||
|
const needsEmailVerification =
|
||||||
|
!isSelfHost &&
|
||||||
|
checkEmailConfirmed &&
|
||||||
|
!!currentAccount?.emailConfirmed &&
|
||||||
|
isNewEnough
|
||||||
|
|
||||||
return {needsEmailVerification}
|
return {needsEmailVerification}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user