Password change detection updated not to rely on default password value any more, but monitors password control change events

This commit is contained in:
Simon Rozman 2016-09-26 10:16:37 +02:00
parent 79cc1af86f
commit c41bc3908e
4 changed files with 22 additions and 11 deletions

View File

@ -844,6 +844,7 @@ public:
/// \param[in] is_config Is this panel used to config credentials?
///
wxPasswordCredentialsPanel(const eap::config_provider &prov, const eap::config_method_with_cred &cfg, _Tcred &cred, wxWindow* parent, bool is_config = false) :
m_password_set(false),
wxEAPCredentialsPanel<_Tcred, _Tbase>(prov, cfg, cred, parent, is_config)
{
// Load and set icon.
@ -879,7 +880,8 @@ protected:
{
m_identity->SetValue(m_cred.m_identity);
m_identity->SetSelection(0, -1);
m_password->SetValue(m_cred.m_password.empty() ? wxEmptyString : s_dummy_password);
m_password->SetValue(m_cred.m_password.empty() ? wxEmptyString : wxT("dummypass"));
m_password_set = false;
if (!m_is_config && m_cfg.m_use_cred) {
// Credential prompt mode & Using configured credentials
@ -898,24 +900,23 @@ protected:
return false;
m_cred.m_identity = m_identity->GetValue();
wxString pass = m_password->GetValue();
if (pass.compare(s_dummy_password) != 0) {
m_cred.m_password = pass;
pass.assign(pass.length(), wxT('*'));
}
if (m_password_set)
m_cred.m_password = m_password->GetValue();
return true;
}
virtual void OnPasswordText(wxCommandEvent& /*event*/)
{
m_password_set = true;
}
/// \endcond
private:
static const wxStringCharType *s_dummy_password;
bool m_password_set;
};
template <class _Tcred, class _Tbase>
const wxStringCharType *wxPasswordCredentialsPanel<_Tcred, _Tbase>::s_dummy_password = wxT("dummypass");
inline wxIcon wxLoadIconFromResource(HINSTANCE hinst, PCWSTR pszName, int cx, int cy)
{

View File

@ -383,10 +383,16 @@ wxPasswordCredentialsPanelBase::wxPasswordCredentialsPanelBase( wxWindow* parent
this->SetSizer( m_sb_credentials );
this->Layout();
// Connect Events
m_password->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( wxPasswordCredentialsPanelBase::OnPasswordText ), NULL, this );
}
wxPasswordCredentialsPanelBase::~wxPasswordCredentialsPanelBase()
{
// Disconnect Events
m_password->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( wxPasswordCredentialsPanelBase::OnPasswordText ), NULL, this );
}
wxEAPProviderContactInfoPanelBase::wxEAPProviderContactInfoPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )

View File

@ -2929,7 +2929,7 @@
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnText">OnPasswordText</event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>

View File

@ -207,6 +207,10 @@ class wxPasswordCredentialsPanelBase : public wxEAPCredentialsPanelBase
wxTextCtrl* m_identity;
wxStaticText* m_password_label;
wxTextCtrl* m_password;
// Virtual event handlers, overide them in your derived class
virtual void OnPasswordText( wxCommandEvent& event ) { event.Skip(); }
public: