Don't do postback for check of IDN domain name. Prohibit wrong use and show error

This commit is contained in:
Olov Karlsson 2014-12-25 23:22:53 +01:00
parent 47f2c512b4
commit cf749150c0
5 changed files with 48 additions and 22 deletions

View file

@ -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);
}
}
}