From cf749150c06a38652352cbd514bd7a761f332c00 Mon Sep 17 00:00:00 2001 From: Olov Karlsson Date: Thu, 25 Dec 2014 23:22:53 +0100 Subject: [PATCH] Don't do postback for check of IDN domain name. Prohibit wrong use and show error --- .../WebsitePanel_SharedResources.ascx.resx | 7 +++- .../WebsitePanel/DomainsAddDomain.ascx | 6 +--- .../WebsitePanel/DomainsAddDomain.ascx.cs | 22 ++++++++++--- .../WebsitePanel/UserCreateSpace.ascx | 2 +- .../WebsitePanel/UserCreateSpace.ascx.cs | 33 +++++++++++++------ 5 files changed, 48 insertions(+), 22 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx index c8d36c92..f3dc6d89 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -5620,5 +5620,10 @@ Check domain expiration date - + + You cannot use a IDN domain name for mail + + + You cannot use a IDN domain name for organizations + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsAddDomain.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsAddDomain.ascx index e1f91b1b..7555cf13 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsAddDomain.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsAddDomain.ascx @@ -10,12 +10,8 @@

- +

-<%-- -

- -

--%> diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsAddDomain.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsAddDomain.ascx.cs index 017e6797..6158be2b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsAddDomain.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/DomainsAddDomain.ascx.cs @@ -260,15 +260,27 @@ namespace WebsitePanel.Portal } protected void btnAdd_Click(object sender, EventArgs e) { - AddDomain(); + if (CheckForCorrectIdnDomainUsage(DomainName.Text)) + { + AddDomain(); + } } + private bool CheckForCorrectIdnDomainUsage(string domainName) + { + // If the choosen domain is a idn domain, don't allow to create mail + if (Utils.IsIdnDomain(domainName) && PointMailDomain.Checked) + { + ShowErrorMessage("IDNDOMAIN_NO_MAIL"); + return false; + } + + return true; + } + protected void DomainName_TextChanged(object sender, DomainControl.DomainNameEventArgs e) { - // If the choosen domain is a idn domain, don't allow to create mail - var isIdn = Utils.IsIdnDomain(e.DomainName); - PointMailDomainPanel.Enabled = !isIdn; - PointMailDomain.Checked = !isIdn; + CheckForCorrectIdnDomainUsage(e.DomainName); } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserCreateSpace.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserCreateSpace.ascx index ff40e5e3..1d5fe8a2 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserCreateSpace.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserCreateSpace.ascx @@ -73,7 +73,7 @@ - + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserCreateSpace.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserCreateSpace.ascx.cs index b0cfd4af..18d830b0 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserCreateSpace.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserCreateSpace.ascx.cs @@ -250,7 +250,10 @@ namespace WebsitePanel.Portal protected void btnCreate_Click(object sender, EventArgs e) { - CreateHostingSpace(); + if (CheckForCorrectIdnDomainUsage()) + { + CreateHostingSpace(); + } } protected void rbFtpAccountName_SelectedIndexChanged(object sender, EventArgs e) @@ -268,19 +271,29 @@ namespace WebsitePanel.Portal BindHostingPlan(); } - protected void txtDomainName_OnTextChanged(object sender, DomainControl.DomainNameEventArgs e) + private bool CheckForCorrectIdnDomainUsage() { if (Utils.IsIdnDomain(txtDomainName.Text)) { - fsMail.Disabled = true; - chkIntegratedOUProvisioning.Checked = false; - chkIntegratedOUProvisioning.Enabled = false; - } - else - { - fsMail.Disabled = false; - BindHostingPlan(); + if (chkIntegratedOUProvisioning.Checked) + { + ShowErrorMessage("IDNDOMAIN_NO_ORGANIZATION"); + return false; + } + + if (chkCreateMailAccount.Checked) + { + ShowErrorMessage("IDNDOMAIN_NO_MAIL"); + return false; + } } + + return true; + } + + protected void txtDomainName_OnTextChanged(object sender, DomainControl.DomainNameEventArgs e) + { + CheckForCorrectIdnDomainUsage(); } } } \ No newline at end of file