Few cosmetic fixes on SSL (certificate choice) and selecting of active tab

after completion task
This commit is contained in:
robvde 2012-10-07 08:13:34 +04:00
parent 5f148a9534
commit 0c0b342f69
6 changed files with 47 additions and 67 deletions

View file

@ -109,9 +109,8 @@ namespace WebsitePanel.Portal
private void BindListOfAvailableSslDomains(string websiteName, string domainName)
{
lstDomains.Items.Clear();
lstDomains.Items.Add(new ListItem(websiteName, websiteName));
lstDomains.Items.Add(new ListItem(domainName, domainName));
rbSiteCertificate.Text = websiteName;
rbDomainCertificate.Text = "*." + domainName;
}
public void BindWebItem(WebVirtualDirectory item)
@ -237,25 +236,22 @@ namespace WebsitePanel.Portal
protected void btnCSR_Click(object sender, EventArgs e)
{
string domain = lstDomains.SelectedValue;
// Ensure wildcard certificate request is correct
if (chkWild.Checked)
domain = "*." + domain;
//
string distinguishedName = string.Format(@"CN={0},
O={1},
OU={2},
L={3},
S={4},
C={5}", domain,
txtCompany.Text,
txtOU.Text,
txtCity.Text,
State,
lstCountries.SelectedValue);
C={5}",
rbSiteCertificate.Checked ? rbSiteCertificate.Text : rbDomainCertificate.Text,
txtCompany.Text,
txtOU.Text,
txtCity.Text,
State,
lstCountries.SelectedValue);
SSLCertificate certificate = new SSLCertificate();
certificate.Hostname = domain;
certificate.Hostname = rbSiteCertificate.Checked ? rbSiteCertificate.Text : rbDomainCertificate.Text;
certificate.DistinguishedName = distinguishedName;
certificate.CSRLength = Convert.ToInt32(lstBits.SelectedValue);
certificate.Organisation = txtCompany.Text;
@ -307,18 +303,12 @@ namespace WebsitePanel.Portal
protected void btnRenCSR_Click(object sender, EventArgs e)
{
//
string domain = lstDomains.SelectedValue;
//
if (chkWild.Checked)
domain = "*." + domain;
//
string distinguishedName = string.Format(@"CN={0},
O={1},
OU={2},
L={3},
S={4},
C={5}", domain,
C={5}", rbSiteCertificate.Checked ? rbSiteCertificate.Text : rbDomainCertificate.Text,
txtCompany.Text,
txtOU.Text,
txtCity.Text,
@ -326,7 +316,7 @@ namespace WebsitePanel.Portal
lstCountries.SelectedValue);
SSLCertificate certificate = new SSLCertificate();
certificate.Hostname = domain;
certificate.Hostname = rbSiteCertificate.Checked ? rbSiteCertificate.Text : rbDomainCertificate.Text;
certificate.DistinguishedName = distinguishedName;
certificate.CSRLength = Convert.ToInt32(lstBits.SelectedValue);
certificate.Organisation = txtCompany.Text;
@ -382,6 +372,8 @@ namespace WebsitePanel.Portal
pnlInstallCertificate.Visible = false;
SSLNotInstalled.Visible = true;
//
TabContainer1.ActiveTab = tabInstalled;
RefreshControlLayout(webSiteId);
}
@ -508,12 +500,7 @@ namespace WebsitePanel.Portal
tabCSR.HeaderText = GetLocalizedString("SSLGenereateRenewal.HeaderText");
string hostname = cert.Hostname;
// Check if it is a wildcard certificate
if (!String.IsNullOrEmpty(cert.Hostname) && cert.Hostname.StartsWith("*"))
{
chkWild.Checked = true;
hostname = hostname.Remove(0, 2);
}
// Assign hostname
SetCertHostnameSelection(hostname);
// Assign state
@ -653,14 +640,7 @@ namespace WebsitePanel.Portal
protected void SetCertHostnameSelection(string hostname)
{
//Bind new CSR with current certificate details
var li = lstDomains.Items.FindByValue(hostname);
// Select domain name from the existing certificate
if (li != null)
{
lstDomains.ClearSelection();
li.Selected = true;
}
rbSiteCertificate.Checked = (rbSiteCertificate.Text == hostname);
}
protected void SetCertCountrySelection(string country)