Skip to content

Commit 5fa8263

Browse files
committed
fix: better handle normalization
1 parent cc1481a commit 5fa8263

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

app/components/Header/AuthModal.client.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,23 @@ async function handleCreateAccount() {
2222
2323
async function handleLogin() {
2424
if (handleInput.value) {
25-
await authRedirect(handleInput.value.trim().replace('@', ''))
25+
await authRedirect(handleInput.value)
2626
}
2727
}
28+
29+
watch(handleInput, newHandleInput => {
30+
if (!newHandleInput) return
31+
32+
const normalized = newHandleInput
33+
.trim()
34+
.replace(/^@/, '')
35+
.toLowerCase()
36+
.replace(/[^a-z0-9.-]/g, '')
37+
38+
if (normalized !== newHandleInput) {
39+
handleInput.value = normalized
40+
}
41+
})
2842
</script>
2943

3044
<template>

0 commit comments

Comments
 (0)