diff --git a/lib/TLS_UI/res/wxTLS_UI.cpp b/lib/TLS_UI/res/wxTLS_UI.cpp index 2c7c0f1..458f3c9 100644 --- a/lib/TLS_UI/res/wxTLS_UI.cpp +++ b/lib/TLS_UI/res/wxTLS_UI.cpp @@ -128,38 +128,16 @@ wxEAPCredentialsPromptTLSPanelBase::wxEAPCredentialsPromptTLSPanelBase( wxWindow wxBoxSizer* sb_credentials_vert; sb_credentials_vert = new wxBoxSizer( wxVERTICAL ); - m_credentials_label = new wxStaticText( sb_credentials->GetStaticBox(), wxID_ANY, _("Please select your client certificate to use for authentication."), wxDefaultPosition, wxDefaultSize, 0 ); - m_credentials_label->Wrap( 440 ); - sb_credentials_vert->Add( m_credentials_label, 0, wxALL|wxEXPAND, 5 ); + m_certificate_label = new wxStaticText( sb_credentials->GetStaticBox(), wxID_ANY, _("Please select your client &certificate to use for authentication."), wxDefaultPosition, wxDefaultSize, 0 ); + m_certificate_label->Wrap( 440 ); + sb_credentials_vert->Add( m_certificate_label, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - wxBoxSizer* sb_cert_radio; - sb_cert_radio = new wxBoxSizer( wxVERTICAL ); + wxArrayString m_certificateChoices; + m_certificate = new wxChoice( sb_credentials->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_certificateChoices, wxCB_SORT ); + m_certificate->SetSelection( 0 ); + m_certificate->SetToolTip( _("Client certificate to use for authentication") ); - m_cert_none = new wxRadioButton( sb_credentials->GetStaticBox(), wxID_ANY, _("Co&nnect without providing a client certificate"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); - m_cert_none->SetToolTip( _("Select if your server does not require you to provide a client certificate") ); - - sb_cert_radio->Add( m_cert_none, 1, wxEXPAND, 5 ); - - wxBoxSizer* sb_cert_select; - sb_cert_select = new wxBoxSizer( wxHORIZONTAL ); - - m_cert_select = new wxRadioButton( sb_credentials->GetStaticBox(), wxID_ANY, _("Use the following &certificate:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_cert_select->SetToolTip( _("Select if you need to provide a client certificate when connecting") ); - - sb_cert_select->Add( m_cert_select, 0, wxEXPAND, 5 ); - - wxArrayString m_cert_select_valChoices; - m_cert_select_val = new wxChoice( sb_credentials->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cert_select_valChoices, wxCB_SORT ); - m_cert_select_val->SetSelection( 0 ); - m_cert_select_val->SetToolTip( _("Client certificate to use for authentication") ); - - sb_cert_select->Add( m_cert_select_val, 1, wxEXPAND, 5 ); - - - sb_cert_radio->Add( sb_cert_select, 1, wxEXPAND, 5 ); - - - sb_credentials_vert->Add( sb_cert_radio, 0, wxEXPAND|wxALL, 5 ); + sb_credentials_vert->Add( m_certificate, 0, wxEXPAND|wxALL, 5 ); wxBoxSizer* sb_identity; sb_identity = new wxBoxSizer( wxVERTICAL ); @@ -178,7 +156,7 @@ wxEAPCredentialsPromptTLSPanelBase::wxEAPCredentialsPromptTLSPanelBase( wxWindow sb_identity->Add( m_identity_note, 0, wxALIGN_RIGHT, 5 ); - sb_credentials_vert->Add( sb_identity, 1, wxEXPAND|wxALL, 5 ); + sb_credentials_vert->Add( sb_identity, 0, wxEXPAND|wxALL, 5 ); m_remember = new wxCheckBox( sb_credentials->GetStaticBox(), wxID_ANY, _("&Remember"), wxDefaultPosition, wxDefaultSize, 0 ); m_remember->SetHelpText( _("Check if you would like to save certificate selection") ); diff --git a/lib/TLS_UI/res/wxTLS_UI.fbp b/lib/TLS_UI/res/wxTLS_UI.fbp index 3f845b0..2a6a06b 100644 --- a/lib/TLS_UI/res/wxTLS_UI.fbp +++ b/lib/TLS_UI/res/wxTLS_UI.fbp @@ -1160,7 +1160,7 @@ none 5 - wxALL|wxEXPAND + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -1190,7 +1190,7 @@ 0 0 wxID_ANY - Please select your client certificate to use for authentication. + Please select your client &certificate to use for authentication. 0 @@ -1198,7 +1198,7 @@ 0 1 - m_credentials_label + m_certificate_label 1 @@ -1245,292 +1245,94 @@ 5 wxEXPAND|wxALL 0 - + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 - sb_cert_radio - wxVERTICAL - none - - 5 - wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Co&nnect without providing a client certificate - - 0 - - - 0 - - 1 - m_cert_none - 1 - - - protected - 1 - - Resizable - 1 - - wxRB_GROUP - - 0 - Select if your server does not require you to provide a client certificate - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - - sb_cert_select - wxHORIZONTAL - none - - 5 - wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Use the following &certificate: - - 0 - - - 0 - - 1 - m_cert_select - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Select if you need to provide a client certificate when connecting - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_cert_select_val - 1 - - - protected - 1 - - Resizable - 0 - 1 - - wxCB_SORT - ; - 0 - Client certificate to use for authentication - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 1 + m_certificate + 1 + + + protected + 1 + + Resizable + 0 + 1 + + wxCB_SORT + ; + 0 + Client certificate to use for authentication + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 wxEXPAND|wxALL - 1 + 0 sb_identity diff --git a/lib/TLS_UI/res/wxTLS_UI.h b/lib/TLS_UI/res/wxTLS_UI.h index c1a1112..591983b 100644 --- a/lib/TLS_UI/res/wxTLS_UI.h +++ b/lib/TLS_UI/res/wxTLS_UI.h @@ -30,7 +30,6 @@ class wxEAPCredentialsPanelBase; #include #include #include -#include #include #include @@ -79,10 +78,8 @@ class wxEAPCredentialsPromptTLSPanelBase : public wxEAPCredentialsPanelBase protected: wxStaticBitmap* m_credentials_icon; - wxStaticText* m_credentials_label; - wxRadioButton* m_cert_none; - wxRadioButton* m_cert_select; - wxChoice* m_cert_select_val; + wxStaticText* m_certificate_label; + wxChoice* m_certificate; wxStaticText* m_identity_label; wxTextCtrl* m_identity; wxStaticText* m_identity_note; diff --git a/lib/TLS_UI/src/TLS_UI.cpp b/lib/TLS_UI/src/TLS_UI.cpp index a00d8dc..b153d06 100644 --- a/lib/TLS_UI/src/TLS_UI.cpp +++ b/lib/TLS_UI/src/TLS_UI.cpp @@ -324,6 +324,7 @@ wxEAPCredentialsPromptTLSPanel::wxEAPCredentialsPromptTLSPanel(const eap::config bool wxEAPCredentialsPromptTLSPanel::TransferDataToWindow() { // Populate certificate list. + m_certificate->Append(_("")); bool is_found = false; winstd::cert_store store; if (store.create(CERT_STORE_PROV_SYSTEM, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, (HCRYPTPROV)NULL, CERT_SYSTEM_STORE_CURRENT_USER, _T("My"))) { @@ -343,21 +344,16 @@ bool wxEAPCredentialsPromptTLSPanel::TransferDataToWindow() m_cred.m_cert->cbCertEncoded == data->m_cert->cbCertEncoded && memcmp(m_cred.m_cert->pbCertEncoded, data->m_cert->pbCertEncoded, m_cred.m_cert->cbCertEncoded) == 0; winstd::tstring name(std::move(eap::get_cert_title(cert))); - int i = m_cert_select_val->Append(name, data.release()); + int i = m_certificate->Append(name, data.release()); if (is_selected) { - m_cert_select_val->SetSelection(i); + m_certificate->SetSelection(i); is_found = true; } } } - if (is_found) { - m_cert_select->SetValue(true); - } else { - m_cert_none->SetValue(true); - if (!m_cert_select_val->IsEmpty()) - m_cert_select_val->SetSelection(0); - } + if (!is_found) + m_certificate->SetSelection(0); m_identity->SetValue(m_cred.m_identity); @@ -367,15 +363,11 @@ bool wxEAPCredentialsPromptTLSPanel::TransferDataToWindow() bool wxEAPCredentialsPromptTLSPanel::TransferDataFromWindow() { - if (m_cert_none->GetValue()) + const wxCertificateClientData *data = dynamic_cast(m_certificate->GetClientObject(m_certificate->GetSelection())); + if (data) + m_cred.m_cert.attach_duplicated(data->m_cert); + else m_cred.m_cert.free(); - else { - const wxCertificateClientData *data = dynamic_cast(m_cert_select_val->GetClientObject(m_cert_select_val->GetSelection())); - if (data) - m_cred.m_cert.attach_duplicated(data->m_cert); - else - m_cred.m_cert.free(); - } m_cred.m_identity = m_identity->GetValue(); @@ -389,20 +381,12 @@ void wxEAPCredentialsPromptTLSPanel::OnUpdateUI(wxUpdateUIEvent& /*event*/) { if (!m_is_config && m_cfg.m_use_cred) { // Credential prompt mode & Using configured credentials - // To avoid run-away selection of radio buttons, disable the selected one last. - if (m_cert_none->GetValue()) { - m_cert_select->Enable(false); - m_cert_none ->Enable(false); - } else { - m_cert_none ->Enable(false); - m_cert_select->Enable(false); - } - m_cert_select_val->Enable(false); - m_identity->Enable(false); + m_certificate->Enable(false); + m_identity ->Enable(false); } else { - // Configuration mode or using own credentials. Selectively enable/disable controls. - m_cert_select_val->Enable(m_cert_select->GetValue()); - m_identity->Enable(true); + // Configuration mode or using own credentials. Enable controls. + m_certificate->Enable(true); + m_identity ->Enable(true); } }