diff options
author | Christian Wieninger <cwieninger (at) gmx (dot) de> | 2007-05-03 10:28:13 +0000 |
---|---|---|
committer | Christian Wieninger <cwieninger (at) gmx (dot) de> | 2007-05-03 10:28:13 +0000 |
commit | edc0cb8937697a1ddb670fc847db4ef04e10dc5c (patch) | |
tree | 5d712dd49f8e71791eb51240d51fe6a5b40d8a09 /setup.cpp | |
parent | e806ce66c09209ed2659df4342fb80a6e99f9b68 (diff) | |
download | vdr-plugin-live-edc0cb8937697a1ddb670fc847db4ef04e10dc5c.tar.gz vdr-plugin-live-edc0cb8937697a1ddb670fc847db4ef04e10dc5c.tar.bz2 |
- admin password in setup is now hidden
Diffstat (limited to 'setup.cpp')
-rw-r--r-- | setup.cpp | 58 |
1 files changed, 57 insertions, 1 deletions
@@ -121,13 +121,22 @@ cMenuSetupLive::cMenuSetupLive(): strcpy(m_adminLogin, vdrlive::LiveSetup().GetAdminLogin().c_str()); strcpy(m_adminPassword, vdrlive::LiveSetup().GetAdminPassword().c_str()); + string strHidden(strlen(m_adminPassword), '*'); + strcpy(m_tmpPassword, strHidden.c_str()); + Set(); +} + +void cMenuSetupLive::Set(void) +{ + int current = Current(); Clear(); //Add(new cMenuEditIntItem(tr("Last channel to display"), &m_lastChannel, 0, 65536)); Add(new cMenuEditChanItem(tr("Last channel to display"), &m_lastChannel, tr("No limit"))); //Add(new cMenuEditIntItem(tr("Screenshot interval"), &m_lastChannel, 0, 65536)); Add(new cMenuEditBoolItem(tr("Use authentication"), &m_useAuth, tr("No"), tr("Yes"))); Add(new cMenuEditStrItem( tr("Admin login"), m_adminLogin, 12, tr(FileNameChars))); - Add(new cMenuEditStrItem( tr("Admin password"), m_adminPassword, 12, tr(FileNameChars))); + Add(new cMenuEditStrItem( tr("Admin password"), m_tmpPassword, 12, tr(FileNameChars))); + SetCurrent(Get(current)); Display(); } @@ -146,6 +155,53 @@ void cMenuSetupLive::Store(void) SetupStore("AdminPassword", m_adminPassword); } +bool cMenuSetupLive::InEditMode(const char* ItemText, const char* ItemName, const char* ItemValue) +{ + bool bEditMode = true; + // ugly solution to detect, if in edit mode + char* value = strdup(ItemText); + strreplace(value, ItemName, ""); + strreplace(value, ":\t", ""); + // for bigpatch + strreplace(value, "\t", ""); + if (strlen(value) == strlen(ItemValue)) + bEditMode = false; + free(value); + return bEditMode; +} + +eOSState cMenuSetupLive::ProcessKey(eKeys Key) +{ + const char* ItemText = Get(Current())->Text(); + bool bPassWasInEditMode = false; + if (ItemText && strlen(ItemText) > 0 && strstr(ItemText, tr("Admin password")) == ItemText) + bPassWasInEditMode = InEditMode(ItemText, tr("Admin password"), m_tmpPassword); + + eOSState state = cMenuSetupPage::ProcessKey(Key); + + ItemText = Get(Current())->Text(); + bool bPassIsInEditMode = false; + if (ItemText && strlen(ItemText) > 0 && strstr(ItemText, tr("Admin password")) == ItemText) + bPassIsInEditMode = InEditMode(ItemText, tr("Admin password"), m_tmpPassword); + + if (bPassWasInEditMode && !bPassIsInEditMode) + { + strcpy(m_adminPassword, m_tmpPassword); + string strHidden(strlen(m_adminPassword), '*'); + strcpy(m_tmpPassword, strHidden.c_str()); + Set(); + Display(); + } + if (!bPassWasInEditMode && bPassIsInEditMode) + { + strcpy(m_tmpPassword, ""); + Set(); + Display(); + state = cMenuSetupPage::ProcessKey(Key); + } + + return state; +} } // namespace vdrlive |