diff --git a/lib/EAPBase_UI/include/EAP_UI.h b/lib/EAPBase_UI/include/EAP_UI.h index 6734119..e15e063 100644 --- a/lib/EAPBase_UI/include/EAP_UI.h +++ b/lib/EAPBase_UI/include/EAP_UI.h @@ -397,11 +397,11 @@ public: m_cfg(cfg), m_cred(cred), m_target(pszCredTarget), + m_is_config(is_config), _Tbase(parent) { - if (m_target.empty() || is_config) { - // No Credential Manager, or user is setting credentials via configuration UI. - // => Pointless if not stored to Credential Manager + if (m_is_config) { + // In configuration mode, always store credentials (somewhere). m_remember->SetValue(true); m_remember->Enable(false); } @@ -412,17 +412,17 @@ protected: virtual bool TransferDataToWindow() { - if (!m_target.empty()) { + if (!m_target.empty() && m_is_config) { // Read credentials from Credential Manager EAP_ERROR *pEapError; - if (m_cred.retrieve(m_target.c_str(), &pEapError)) { - m_remember->SetValue(true); - } else if (pEapError) { - if (pEapError->dwWinError != ERROR_NOT_FOUND) - wxLogError(winstd::tstring_printf(_("Error reading credentials from Credential Manager: %ls (error %u)"), pEapError->pRootCauseString, pEapError->dwWinError).c_str()); - m_cred.m_module.free_error_memory(pEapError); - } else - wxLogError(_("Reading credentials failed.")); + if (!m_cred.retrieve(m_target.c_str(), &pEapError)) { + if (pEapError) { + if (pEapError->dwWinError != ERROR_NOT_FOUND) + wxLogError(winstd::tstring_printf(_("Error reading credentials from Credential Manager: %ls (error %u)"), pEapError->pRootCauseString, pEapError->dwWinError).c_str()); + m_cred.m_module.free_error_memory(pEapError); + } else + wxLogError(_("Reading credentials failed.")); + } } return _Tbase::TransferDataToWindow(); @@ -457,6 +457,7 @@ protected: const eap::config_method &m_cfg; ///< Method configuration eap::credentials &m_cred; ///< Generic credentials winstd::tstring m_target; ///< Credential Manager target + bool m_is_config; ///< Is this a configuration dialog? }; diff --git a/lib/TTLS_UI/src/Module.cpp b/lib/TTLS_UI/src/Module.cpp index 3d0824e..8236fcc 100644 --- a/lib/TTLS_UI/src/Module.cpp +++ b/lib/TTLS_UI/src/Module.cpp @@ -101,7 +101,7 @@ bool eap::peer_ttls_ui::invoke_identity_ui( // Create and launch credentials dialog. wxEAPCredentialsDialog dlg(cfg_prov, &parent); - wxTTLSCredentialsPanel *panel = new wxTTLSCredentialsPanel(cfg_prov, *cfg_method, cred, cfg_prov.m_id.c_str(), &dlg, true); + wxTTLSCredentialsPanel *panel = new wxTTLSCredentialsPanel(cfg_prov, *cfg_method, cred, cfg_prov.m_id.c_str(), &dlg); dlg.AddContents((wxPanel**)&panel, 1); result = dlg.ShowModal();