Skip to content

Commit c572ae9

Browse files
shleeableYour Name
andauthored
Fix #418 - remove spaces from validation code form. (#431)
* fix: set chmod 755 on avatars-temp directory creation Fixes permission denied error on subsequent Docker builds * fix: strip spaces from verification code input Users can now copy-paste verification codes with spaces (e.g. '1 2 3 4 5 6') and they will be automatically cleaned to '123456' before validation. Fixes #418 * Revert "fix: set chmod 755 on avatars-temp directory creation" This reverts commit 185282f. * prettier --------- Co-authored-by: Your Name <you@example.com>
1 parent 3703923 commit c572ae9

2 files changed

Lines changed: 18 additions & 14 deletions

File tree

resources/js/components/AuthModal.vue

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,11 @@ const handleVerifyCode = async () => {
12211221
clearMessages()
12221222
loading.value = true
12231223
1224-
if (form.value.verificationCode?.length != 6) {
1224+
// Strip spaces and non-numeric characters from the code
1225+
const cleanCode = form.value.verificationCode?.replace(/[^0-9]/g, '') || ''
1226+
form.value.verificationCode = cleanCode
1227+
1228+
if (cleanCode.length != 6) {
12251229
setError(t('common.invalidCodeLength'))
12261230
setTimeout(() => {
12271231
clearMessages()
@@ -1231,12 +1235,10 @@ const handleVerifyCode = async () => {
12311235
}
12321236
12331237
try {
1234-
await authStore
1235-
.verifyEmailVerification(form.value.email, form.value.verificationCode)
1236-
.then((res) => {
1237-
registrationStep.value = 3
1238-
setSuccess(t('common.emailVerifiedSuccessfully'))
1239-
})
1238+
await authStore.verifyEmailVerification(form.value.email, cleanCode).then((res) => {
1239+
registrationStep.value = 3
1240+
setSuccess(t('common.emailVerifiedSuccessfully'))
1241+
})
12401242
} catch (err) {
12411243
console.error('Verification error:', err)
12421244

resources/js/pages/auth/app-register.vue

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,11 @@ const handleVerifyCode = async () => {
751751
clearMessages()
752752
loading.value = true
753753
754-
if (form.value.verificationCode?.length != 6) {
754+
// Strip spaces and non-numeric characters from the code
755+
const cleanCode = form.value.verificationCode?.replace(/[^0-9]/g, '') || ''
756+
form.value.verificationCode = cleanCode
757+
758+
if (cleanCode.length != 6) {
755759
setError(t('common.invalidCodeLength'))
756760
setTimeout(() => {
757761
clearMessages()
@@ -761,12 +765,10 @@ const handleVerifyCode = async () => {
761765
}
762766
763767
try {
764-
await authStore
765-
.verifyEmailVerification(form.value.email, form.value.verificationCode)
766-
.then((res) => {
767-
registrationStep.value = 3
768-
setSuccess(t('common.emailVerifiedSuccessfully'))
769-
})
768+
await authStore.verifyEmailVerification(form.value.email, cleanCode).then((res) => {
769+
registrationStep.value = 3
770+
setSuccess(t('common.emailVerifiedSuccessfully'))
771+
})
770772
} catch (err) {
771773
console.error('Verification error:', err)
772774

0 commit comments

Comments
 (0)