[ELI5] Validate too long handles in signup (#7422)

* validate too long handles in signup

* make change handle screen generic
This commit is contained in:
Samuel Newman
2025-01-10 17:57:10 +00:00
committed by GitHub
parent d79c66af8a
commit a7da646286
3 changed files with 24 additions and 11 deletions
@@ -172,13 +172,11 @@ function ProvidedHandlePage({
const host = serviceInfo.availableUserDomains[0]
const validation = useMemo(
() => validateHandle(subdomain, host),
() => validateHandle(subdomain, host, true),
[subdomain, host],
)
const isTooLong = subdomain.length > 18
const isInvalid =
isTooLong ||
!validation.handleChars ||
!validation.hyphenStartOrEnd ||
!validation.totalLength
@@ -231,10 +229,10 @@ function ProvidedHandlePage({
label={_(msg`Save new handle`)}
variant="solid"
size="large"
color={validation.overall && !isTooLong ? 'primary' : 'secondary'}
disabled={!validation.overall && !isTooLong}
color={validation.overall ? 'primary' : 'secondary'}
disabled={!validation.overall}
onPress={() => {
if (validation.overall && !isTooLong) {
if (validation.overall) {
changeHandle({handle: createFullHandle(subdomain, host)})
}
}}>