From 47a24f476ef551a75ccf6b082c8139e15942c081 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Mon, 2 Jun 2014 12:58:55 +0200 Subject: Show username stored in config if asking for password Thanks to Unit 193 for the suggestion. --- src/main.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 2e9203c..887bb84 100644 --- a/src/main.c +++ b/src/main.c @@ -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; -- cgit v1.2.3