fix: Add email validation in the email field of the new contact form (#4909)
This commit is contained in:
@@ -71,7 +71,7 @@
|
|||||||
"ERROR_MESSAGE": "There was an error, please try again"
|
"ERROR_MESSAGE": "There was an error, please try again"
|
||||||
},
|
},
|
||||||
"DELETE_NOTE": {
|
"DELETE_NOTE": {
|
||||||
"CONFIRM":{
|
"CONFIRM": {
|
||||||
"TITLE": "Confirm Deletion",
|
"TITLE": "Confirm Deletion",
|
||||||
"MESSAGE": "Are you want sure to delete this note?",
|
"MESSAGE": "Are you want sure to delete this note?",
|
||||||
"YES": "Yes, Delete it",
|
"YES": "Yes, Delete it",
|
||||||
@@ -111,7 +111,8 @@
|
|||||||
"EMAIL_ADDRESS": {
|
"EMAIL_ADDRESS": {
|
||||||
"PLACEHOLDER": "Enter the email address of the contact",
|
"PLACEHOLDER": "Enter the email address of the contact",
|
||||||
"LABEL": "Email Address",
|
"LABEL": "Email Address",
|
||||||
"DUPLICATE": "This email address is in use for another contact."
|
"DUPLICATE": "This email address is in use for another contact.",
|
||||||
|
"ERROR": "Please enter a valid email address."
|
||||||
},
|
},
|
||||||
"PHONE_NUMBER": {
|
"PHONE_NUMBER": {
|
||||||
"PLACEHOLDER": "Enter the phone number of the contact",
|
"PLACEHOLDER": "Enter the phone number of the contact",
|
||||||
|
|||||||
@@ -20,6 +20,9 @@
|
|||||||
:placeholder="$t('CONTACT_FORM.FORM.EMAIL_ADDRESS.PLACEHOLDER')"
|
:placeholder="$t('CONTACT_FORM.FORM.EMAIL_ADDRESS.PLACEHOLDER')"
|
||||||
@input="$v.email.$touch"
|
@input="$v.email.$touch"
|
||||||
/>
|
/>
|
||||||
|
<span v-if="$v.email.$error" class="message">
|
||||||
|
{{ $t('CONTACT_FORM.FORM.EMAIL_ADDRESS.ERROR') }}
|
||||||
|
</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -99,7 +102,7 @@ import {
|
|||||||
DuplicateContactException,
|
DuplicateContactException,
|
||||||
ExceptionWithMessage,
|
ExceptionWithMessage,
|
||||||
} from 'shared/helpers/CustomErrors';
|
} from 'shared/helpers/CustomErrors';
|
||||||
import { required } from 'vuelidate/lib/validators';
|
import { required, email } from 'vuelidate/lib/validators';
|
||||||
|
|
||||||
import { isPhoneE164OrEmpty } from 'shared/helpers/Validators';
|
import { isPhoneE164OrEmpty } from 'shared/helpers/Validators';
|
||||||
|
|
||||||
@@ -145,7 +148,9 @@ export default {
|
|||||||
required,
|
required,
|
||||||
},
|
},
|
||||||
description: {},
|
description: {},
|
||||||
email: {},
|
email: {
|
||||||
|
email,
|
||||||
|
},
|
||||||
companyName: {},
|
companyName: {},
|
||||||
phoneNumber: {
|
phoneNumber: {
|
||||||
isPhoneE164OrEmpty,
|
isPhoneE164OrEmpty,
|
||||||
@@ -169,11 +174,15 @@ export default {
|
|||||||
this.$emit('success');
|
this.$emit('success');
|
||||||
},
|
},
|
||||||
setContactObject() {
|
setContactObject() {
|
||||||
const { email: email, phone_number: phoneNumber, name } = this.contact;
|
const {
|
||||||
|
email: emailAddress,
|
||||||
|
phone_number: phoneNumber,
|
||||||
|
name,
|
||||||
|
} = this.contact;
|
||||||
const additionalAttributes = this.contact.additional_attributes || {};
|
const additionalAttributes = this.contact.additional_attributes || {};
|
||||||
|
|
||||||
this.name = name || '';
|
this.name = name || '';
|
||||||
this.email = email || '';
|
this.email = emailAddress || '';
|
||||||
this.phoneNumber = phoneNumber || '';
|
this.phoneNumber = phoneNumber || '';
|
||||||
this.companyName = additionalAttributes.company_name || '';
|
this.companyName = additionalAttributes.company_name || '';
|
||||||
this.description = additionalAttributes.description || '';
|
this.description = additionalAttributes.description || '';
|
||||||
|
|||||||
@@ -50,12 +50,10 @@
|
|||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import alertMixin from 'shared/mixins/alertMixin';
|
import alertMixin from 'shared/mixins/alertMixin';
|
||||||
import { required } from 'vuelidate/lib/validators';
|
import { required, email } from 'vuelidate/lib/validators';
|
||||||
import router from '../../../../index';
|
import router from '../../../../index';
|
||||||
import PageHeader from '../../SettingsSubPageHeader';
|
import PageHeader from '../../SettingsSubPageHeader';
|
||||||
|
|
||||||
const validEmail = (value = '') => value.includes('@');
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
PageHeader,
|
PageHeader,
|
||||||
@@ -74,7 +72,7 @@ export default {
|
|||||||
},
|
},
|
||||||
validations: {
|
validations: {
|
||||||
channelName: { required },
|
channelName: { required },
|
||||||
email: { required, validEmail },
|
email: { required, email },
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async createChannel() {
|
async createChannel() {
|
||||||
|
|||||||
Reference in New Issue
Block a user