fix: Signup form validation issue with captcha handling (#11232)
# Pull Request Template ## Description This PR improves password validation in the signup form and ensures proper captcha handling during form submission. **Changes:** 1. Display an error message if the password is invalid. 2. Disable the account creation button when the password is invalid. Fixes https://linear.app/chatwoot/issue/CW-4199/signup-issues ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? ### Loom video https://www.loom.com/share/d0ff04f12b98473e837b7f43af444f85?sid=04473cea-4717-4de8-b3fe-33ab0faed5e9 ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [ ] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules
This commit is contained in:
@@ -85,10 +85,10 @@ export default {
|
|||||||
if (!password.$error) {
|
if (!password.$error) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
if (!password.minLength) {
|
if (password.minLength.$invalid) {
|
||||||
return this.$t('REGISTER.PASSWORD.ERROR');
|
return this.$t('REGISTER.PASSWORD.ERROR');
|
||||||
}
|
}
|
||||||
if (!password.isValidPassword) {
|
if (password.isValidPassword.$invalid) {
|
||||||
return this.$t('REGISTER.PASSWORD.IS_INVALID_PASSWORD');
|
return this.$t('REGISTER.PASSWORD.IS_INVALID_PASSWORD');
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
@@ -96,6 +96,9 @@ export default {
|
|||||||
showGoogleOAuth() {
|
showGoogleOAuth() {
|
||||||
return Boolean(window.chatwootConfig.googleOAuthClientId);
|
return Boolean(window.chatwootConfig.googleOAuthClientId);
|
||||||
},
|
},
|
||||||
|
isFormValid() {
|
||||||
|
return !this.v$.$invalid && this.hasAValidCaptcha;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async submit() {
|
async submit() {
|
||||||
@@ -120,6 +123,7 @@ export default {
|
|||||||
onRecaptchaVerified(token) {
|
onRecaptchaVerified(token) {
|
||||||
this.credentials.hCaptchaClientResponse = token;
|
this.credentials.hCaptchaClientResponse = token;
|
||||||
this.didCaptchaReset = false;
|
this.didCaptchaReset = false;
|
||||||
|
this.v$.$touch();
|
||||||
},
|
},
|
||||||
resetCaptcha() {
|
resetCaptcha() {
|
||||||
if (!this.globalConfig.hCaptchaSiteKey) {
|
if (!this.globalConfig.hCaptchaSiteKey) {
|
||||||
@@ -198,7 +202,7 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
<SubmitButton
|
<SubmitButton
|
||||||
:button-text="$t('REGISTER.SUBMIT')"
|
:button-text="$t('REGISTER.SUBMIT')"
|
||||||
:disabled="isSignupInProgress || !hasAValidCaptcha"
|
:disabled="isSignupInProgress || !isFormValid"
|
||||||
:loading="isSignupInProgress"
|
:loading="isSignupInProgress"
|
||||||
icon-class="arrow-chevron-right"
|
icon-class="arrow-chevron-right"
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user