diff --git a/src/app/config/app-settings.ts b/src/app/config/app-settings.ts index ba8b1349..d38d3774 100644 --- a/src/app/config/app-settings.ts +++ b/src/app/config/app-settings.ts @@ -12,5 +12,6 @@ export class AppSettings { public static HEADER_CONTENT_TYPE = 'application/json'; public static EMAIL_PATTERN = '[a-z|A-Z|0-9]+[@]+[a-z|A-Z|0-9]+[.]+([a-z|A-Z|0-9]){2}'; public static USERNAME_REGEX = '/^[a-zA-Z0-9_]{1,15}$/'; - public static URL_PATTERN = '^((ht|f)tp(s?))\://([0-9a-zA-Z\-]+\.)+[a-zA-Z]{2,6}(\:[0-9]+)?(/\S*)?$'; + public static COMPANY_NAME_REGEX = '^[a-zA-Z0-9- ]*$'; + public static URL_PATTERN = '^((ht|f)tp(s?))\://([0-9a-zA-Z\-]+\.)+[0-9a-zA-Z]{2,6}(\:[0-9]+)?(/\S*)?$'; } diff --git a/src/app/modules/corporate-contributor/component/add-company-modal/add-company-modal.component.html b/src/app/modules/corporate-contributor/component/add-company-modal/add-company-modal.component.html index e0afb008..055c1fc1 100644 --- a/src/app/modules/corporate-contributor/component/add-company-modal/add-company-modal.component.html +++ b/src/app/modules/corporate-contributor/component/add-company-modal/add-company-modal.component.html @@ -13,6 +13,9 @@
Company name is required
+
+ Company name should be atleast 2 characters. +
Company name should not be exceed 60 characters
@@ -70,4 +73,4 @@ - \ No newline at end of file + diff --git a/src/app/modules/corporate-contributor/component/add-company-modal/add-company-modal.component.ts b/src/app/modules/corporate-contributor/component/add-company-modal/add-company-modal.component.ts index af6a02c2..d8489d4c 100644 --- a/src/app/modules/corporate-contributor/component/add-company-modal/add-company-modal.component.ts +++ b/src/app/modules/corporate-contributor/component/add-company-modal/add-company-modal.component.ts @@ -7,6 +7,7 @@ import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; import { UrlValidator } from 'src/app/shared/validators/website-validator'; import { ClaContributorService } from 'src/app/core/services/cla-contributor.service'; import { StorageService } from 'src/app/shared/services/storage.service'; +import { AppSettings } from 'src/app/config/app-settings'; @Component({ selector: 'app-add-company-modal', @@ -36,7 +37,7 @@ export class AddCompanyModalComponent implements OnInit { this.checkboxText1 = 'Create a complete CommunityBridge profile for your company.'; this.checkboxText2 = ' Leave unchecked if you do not want to create a full profile now.'; this.form = this.formBuilder.group({ - companyName: ['', Validators.compose([Validators.required, Validators.pattern('^[a-zA-Z0-9- ]*$'), Validators.maxLength(60)])], + companyName: ['', Validators.compose([Validators.required, Validators.pattern(AppSettings.COMPANY_NAME_REGEX), Validators.minLength(2), Validators.maxLength(60)])], companyWebsite: ['', Validators.compose([Validators.required, UrlValidator.isValid, Validators.maxLength(255)])], }); }