Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions resources/js/components/AuthModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,11 @@ const handleVerifyCode = async () => {
clearMessages()
loading.value = true

if (form.value.verificationCode?.length != 6) {
// Strip spaces and non-numeric characters from the code
const cleanCode = form.value.verificationCode?.replace(/[^0-9]/g, '') || ''
form.value.verificationCode = cleanCode

if (cleanCode.length != 6) {
setError(t('common.invalidCodeLength'))
setTimeout(() => {
clearMessages()
Expand All @@ -1231,12 +1235,10 @@ const handleVerifyCode = async () => {
}

try {
await authStore
.verifyEmailVerification(form.value.email, form.value.verificationCode)
.then((res) => {
registrationStep.value = 3
setSuccess(t('common.emailVerifiedSuccessfully'))
})
await authStore.verifyEmailVerification(form.value.email, cleanCode).then((res) => {
registrationStep.value = 3
setSuccess(t('common.emailVerifiedSuccessfully'))
})
} catch (err) {
console.error('Verification error:', err)

Expand Down
16 changes: 9 additions & 7 deletions resources/js/pages/auth/app-register.vue
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,11 @@ const handleVerifyCode = async () => {
clearMessages()
loading.value = true

if (form.value.verificationCode?.length != 6) {
// Strip spaces and non-numeric characters from the code
const cleanCode = form.value.verificationCode?.replace(/[^0-9]/g, '') || ''
form.value.verificationCode = cleanCode

if (cleanCode.length != 6) {
setError(t('common.invalidCodeLength'))
setTimeout(() => {
clearMessages()
Expand All @@ -761,12 +765,10 @@ const handleVerifyCode = async () => {
}

try {
await authStore
.verifyEmailVerification(form.value.email, form.value.verificationCode)
.then((res) => {
registrationStep.value = 3
setSuccess(t('common.emailVerifiedSuccessfully'))
})
await authStore.verifyEmailVerification(form.value.email, cleanCode).then((res) => {
registrationStep.value = 3
setSuccess(t('common.emailVerifiedSuccessfully'))
})
} catch (err) {
console.error('Verification error:', err)

Expand Down