diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2014-06-02 12:58:55 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2014-06-02 13:01:36 +0200 |
commit | 47a24f476ef551a75ccf6b082c8139e15942c081 (patch) | |
tree | 99d611a64635f2d05f98939c0941a4eb24ff8107 | |
parent | 0a64272db65201fc2ecb3406b89d895966933b99 (diff) | |
download | pianobar-windows-47a24f476ef551a75ccf6b082c8139e15942c081.tar.gz pianobar-windows-47a24f476ef551a75ccf6b082c8139e15942c081.tar.bz2 pianobar-windows-47a24f476ef551a75ccf6b082c8139e15942c081.zip |
Show username stored in config if asking for password
Thanks to Unit 193 for the suggestion.
-rw-r--r-- | src/main.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -98,17 +98,24 @@ static bool BarMainLoginUser (BarApp_t *app) { */ static bool BarMainGetLoginCredentials (BarSettings_t *settings, BarReadlineFds_t *input) { + bool usernameFromConfig = true; + if (settings->username == NULL) { char nameBuf[100]; BarUiMsg (settings, MSG_QUESTION, "Email: "); BarReadlineStr (nameBuf, sizeof (nameBuf), input, BAR_RL_DEFAULT); settings->username = strdup (nameBuf); + usernameFromConfig = false; } if (settings->password == NULL) { char passBuf[100]; + if (usernameFromConfig) { + BarUiMsg (settings, MSG_QUESTION, "Email: %s\n", settings->username); + } + if (settings->passwordCmd == NULL) { BarUiMsg (settings, MSG_QUESTION, "Password: "); BarReadlineStr (passBuf, sizeof (passBuf), input, BAR_RL_NOECHO); @@ -163,8 +170,7 @@ static bool BarMainGetLoginCredentials (BarSettings_t *settings, return false; } } - - } + } /* end else passwordCmd */ } return true; |