diff --git a/src/Client/src/app/pages/company/editor/editor.component.css b/src/Client/src/app/pages/company/editor/editor.component.css
index afcf5dc..ee89bae 100644
--- a/src/Client/src/app/pages/company/editor/editor.component.css
+++ b/src/Client/src/app/pages/company/editor/editor.component.css
@@ -108,4 +108,14 @@ form {
background-color: var(--Mistox-Dark)\);
height: 40px;
break-inside: avoid;
+}
+
+.error-window {
+ position: absolute;
+ left: calc(50% - 400px);
+ width: 800px;
+ text-align: center;
+ top: 600px;
+ background-color: red;
+ border-radius: 10px;
}
\ No newline at end of file
diff --git a/src/Client/src/app/pages/company/editor/editor.component.html b/src/Client/src/app/pages/company/editor/editor.component.html
index 04eda5b..7435466 100644
--- a/src/Client/src/app/pages/company/editor/editor.component.html
+++ b/src/Client/src/app/pages/company/editor/editor.component.html
@@ -167,4 +167,10 @@
-
\ No newline at end of file
+
+
+@if (ErrorMsg != ""){
+
+
{{ ErrorMsg }}
+
+}
\ No newline at end of file
diff --git a/src/Client/src/app/pages/company/editor/editor.component.ts b/src/Client/src/app/pages/company/editor/editor.component.ts
index 46fe59f..dc1629e 100644
--- a/src/Client/src/app/pages/company/editor/editor.component.ts
+++ b/src/Client/src/app/pages/company/editor/editor.component.ts
@@ -149,9 +149,10 @@ export class CompanyEditorComponent {
return;
}
- if (this.validator.validateURL(company.websiteURL)[0]){
- this.ErrorMsg = "Website is invalid";
- this.focusFrame(3, 1);
+ var urlIsValid = this.validator.validateURL(company.websiteURL);
+ if (urlIsValid[0] == false){
+ this.ErrorMsg = urlIsValid[1];
+ this.focusFrame(1, 0);
return;
}
@@ -167,8 +168,9 @@ export class CompanyEditorComponent {
return;
}
- if (this.validator.validateEmail(company.email)[0]){
- this.ErrorMsg = "Email is invalid";
+ var emailIsValid = this.validator.validateEmail(company.email);
+ if (emailIsValid[0] == false){
+ this.ErrorMsg = emailIsValid[1];
this.focusFrame(3, 0);
return;
}
@@ -179,7 +181,7 @@ export class CompanyEditorComponent {
return;
}
- if (this.validator.validatePhoneNumber(company.phone)[0]){
+ if (this.validator.validatePhoneNumber(company.phone)[0] == false){
this.ErrorMsg = "Phone number is invalid";
this.focusFrame(3, 1);
return;
diff --git a/src/Client/src/app/services/Validation.ts b/src/Client/src/app/services/Validation.ts
index ef7c99a..0887ad9 100644
--- a/src/Client/src/app/services/Validation.ts
+++ b/src/Client/src/app/services/Validation.ts
@@ -46,28 +46,28 @@ export class Validation {
try {
if (urlToParse.protocol !== 'http:' && urlToParse.protocol !== 'https:') {
- return [false, urlToParse.href];
+ return [false, "bad protocol"];
}
const hostname = urlToParse.hostname.toLowerCase();
if (hostname === 'localhost' || hostname.endsWith('.localhost')) {
- return [false, urlToParse.href];
+ return [false, "localhost not allowed"];
}
const privateIpRegex = /^(127\.|10\.|192\.168\.|172\.(1[6-9]|2[0-9]|3[0-1])\.)/;
if (privateIpRegex.test(hostname)) {
- return [false, urlToParse.href];
+ return [false, "internal ipv4 not allowed"];
}
if (hostname.includes(':')) {
if (this.isPrivateIPv6(hostname)) {
- return [false, urlToParse.href];
+ return [false, "internal ipv6 not allowed"];
}
}
return [true, urlToParse.href.substring(0, urlToParse.href.length - 1)];
} catch (e) {
- return [false, urlToParse.href];
+ return [false, "validation error has occurred"];
}
}