chore: Add business email validation on signup (#6037)

This commit is contained in:
Pranav Raj S 2022-12-07 13:03:51 -08:00 committed by GitHub
parent caa45d1d92
commit 6064aad38f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 9 deletions

View file

@ -3,10 +3,10 @@
"TRY_WOOT": "Register an account", "TRY_WOOT": "Register an account",
"TITLE": "Register", "TITLE": "Register",
"TERMS_ACCEPT": "By signing up, you agree to our <a href=\"https://www.chatwoot.com/terms\">T & C</a> and <a href=\"https://www.chatwoot.com/privacy-policy\">Privacy policy</a>", "TERMS_ACCEPT": "By signing up, you agree to our <a href=\"https://www.chatwoot.com/terms\">T & C</a> and <a href=\"https://www.chatwoot.com/privacy-policy\">Privacy policy</a>",
"ACCOUNT_NAME": { "COMPANY_NAME": {
"LABEL": "Account name", "LABEL": "Company name",
"PLACEHOLDER": "Enter an account name. eg: Wayne Enterprises", "PLACEHOLDER": "Enter your company name. eg: Wayne Enterprises",
"ERROR": "Account name is too short" "ERROR": "Company name is too short"
}, },
"FULL_NAME": { "FULL_NAME": {
"LABEL": "Full name", "LABEL": "Full name",
@ -16,7 +16,7 @@
"EMAIL": { "EMAIL": {
"LABEL": "Work email", "LABEL": "Work email",
"PLACEHOLDER": "Enter your work email address. eg: bruce@wayne.enterprises", "PLACEHOLDER": "Enter your work email address. eg: bruce@wayne.enterprises",
"ERROR": "Email address is invalid" "ERROR": "Please enter a valid work email address"
}, },
"PASSWORD": { "PASSWORD": {
"LABEL": "Password", "LABEL": "Password",

View file

@ -39,11 +39,11 @@
<woot-input <woot-input
v-model="credentials.accountName" v-model="credentials.accountName"
:class="{ error: $v.credentials.accountName.$error }" :class="{ error: $v.credentials.accountName.$error }"
:label="$t('REGISTER.ACCOUNT_NAME.LABEL')" :label="$t('REGISTER.COMPANY_NAME.LABEL')"
:placeholder="$t('REGISTER.ACCOUNT_NAME.PLACEHOLDER')" :placeholder="$t('REGISTER.COMPANY_NAME.PLACEHOLDER')"
:error=" :error="
$v.credentials.accountName.$error $v.credentials.accountName.$error
? $t('REGISTER.ACCOUNT_NAME.ERROR') ? $t('REGISTER.COMPANY_NAME.ERROR')
: '' : ''
" "
@blur="$v.credentials.accountName.$touch" @blur="$v.credentials.accountName.$touch"
@ -104,6 +104,9 @@ import alertMixin from 'shared/mixins/alertMixin';
import { DEFAULT_REDIRECT_URL } from '../../constants'; import { DEFAULT_REDIRECT_URL } from '../../constants';
import VueHcaptcha from '@hcaptcha/vue-hcaptcha'; import VueHcaptcha from '@hcaptcha/vue-hcaptcha';
import { isValidPassword } from 'shared/helpers/Validators'; import { isValidPassword } from 'shared/helpers/Validators';
const CompanyEmailValidator = require('company-email-validator');
export default { export default {
components: { components: {
VueHcaptcha, VueHcaptcha,
@ -136,6 +139,9 @@ export default {
email: { email: {
required, required,
email, email,
businessEmailValidator(value) {
return CompanyEmailValidator.isCompanyEmail(value);
},
}, },
password: { password: {
required, required,

View file

@ -1,10 +1,11 @@
import Auth from './Auth'; import Auth from './Auth';
import Confirmation from './Confirmation'; import Confirmation from './Confirmation';
import Signup from './Signup';
import PasswordEdit from './PasswordEdit'; import PasswordEdit from './PasswordEdit';
import ResetPassword from './ResetPassword'; import ResetPassword from './ResetPassword';
import { frontendURL } from '../../helper/URLHelper'; import { frontendURL } from '../../helper/URLHelper';
const Signup = () => import('./Signup');
export default { export default {
routes: [ routes: [
{ {

View file

@ -33,6 +33,7 @@
"babel-plugin-syntax-jsx": "^6.18.0", "babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-vue-jsx": "^3.7.0", "babel-plugin-transform-vue-jsx": "^3.7.0",
"chart.js": "~2.9.4", "chart.js": "~2.9.4",
"company-email-validator": "^1.0.8",
"core-js": "3.11.0", "core-js": "3.11.0",
"date-fns": "2.21.1", "date-fns": "2.21.1",
"date-fns-tz": "^1.3.3", "date-fns-tz": "^1.3.3",

View file

@ -5347,6 +5347,13 @@ commondir@^1.0.1:
resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b"
integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs= integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=
company-email-validator@^1.0.8:
version "1.0.8"
resolved "https://registry.yarnpkg.com/company-email-validator/-/company-email-validator-1.0.8.tgz#b09e4a4c5d4e19eadafbfc8ed7688b39ad24d868"
integrity sha512-zxqY83XAdqxqjEGLAXZCv++3er280aquey/jWCSIFfW3pn85Y1Dk34ljhUpZvh0n4OM+gPsOLjIk6lvHmeSIWg==
dependencies:
email-validator "^2.0.4"
component-emitter@^1.2.1: component-emitter@^1.2.1:
version "1.3.0" version "1.3.0"
resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0"
@ -6451,6 +6458,11 @@ elliptic@^6.5.3:
minimalistic-assert "^1.0.1" minimalistic-assert "^1.0.1"
minimalistic-crypto-utils "^1.0.1" minimalistic-crypto-utils "^1.0.1"
email-validator@^2.0.4:
version "2.0.4"
resolved "https://registry.yarnpkg.com/email-validator/-/email-validator-2.0.4.tgz#b8dfaa5d0dae28f1b03c95881d904d4e40bfe7ed"
integrity sha512-gYCwo7kh5S3IDyZPLZf6hSS0MnZT8QmJFqYvbqlDZSbwdZlY6QZWxJ4i/6UhITOJ4XzyI647Bm2MXKCLqnJ4nQ==
emittery@^0.7.1: emittery@^0.7.1:
version "0.7.2" version "0.7.2"
resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.7.2.tgz#25595908e13af0f5674ab419396e2fb394cdfa82" resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.7.2.tgz#25595908e13af0f5674ab419396e2fb394cdfa82"