diff --git a/ui/cli/src/main/groovy/com/github/thetric/iliasdownloader/cli/configloader/ExistingConfigCliController.groovy b/ui/cli/src/main/groovy/com/github/thetric/iliasdownloader/cli/configloader/ExistingConfigCliController.groovy index 0094972..d325081 100644 --- a/ui/cli/src/main/groovy/com/github/thetric/iliasdownloader/cli/configloader/ExistingConfigCliController.groovy +++ b/ui/cli/src/main/groovy/com/github/thetric/iliasdownloader/cli/configloader/ExistingConfigCliController.groovy @@ -30,15 +30,13 @@ final class ExistingConfigCliController { } private void promptForPassword(IliasService iliasService, UserPreferences prefs) { - while (true) { - try { - String passwordPrompt = resourceBundle.getString('login.credentials.password') - String password = consoleService.readPassword('ilias.credentials.password', passwordPrompt) - iliasService.login(new LoginCredentials(prefs.userName, password)) - return - } catch (IliasAuthenticationException authEx) { - log.catching(Level.DEBUG, authEx) - } + try { + String passwordPrompt = resourceBundle.getString('login.credentials.password') + String namePwPrompt = String.format(passwordPrompt, prefs.userName) + String password = consoleService.readPassword('ilias.credentials.password', namePwPrompt) + iliasService.login(new LoginCredentials(prefs.userName, password)) + } catch (IliasAuthenticationException authEx) { + log.catching(Level.DEBUG, authEx) } } } diff --git a/ui/cli/src/main/groovy/com/github/thetric/iliasdownloader/cli/configloader/SetupController.groovy b/ui/cli/src/main/groovy/com/github/thetric/iliasdownloader/cli/configloader/SetupController.groovy index 863267b..e05e216 100644 --- a/ui/cli/src/main/groovy/com/github/thetric/iliasdownloader/cli/configloader/SetupController.groovy +++ b/ui/cli/src/main/groovy/com/github/thetric/iliasdownloader/cli/configloader/SetupController.groovy @@ -33,16 +33,10 @@ class SetupController { } private IliasService createIliasServiceFromUserUrl() { - while (true) { - String serverUrl = promptForServerUrl() - try { - IliasService iliasService = iliasProvider.apply(serverUrl) - prefs.iliasServerURL = serverUrl - return iliasService - } catch (RuntimeException e) { - log.catching(e) - } - } + String serverUrl = promptForServerUrl() + IliasService iliasService = iliasProvider.apply(serverUrl) + prefs.iliasServerURL = serverUrl + return iliasService } private promptForServerUrl() { @@ -56,7 +50,8 @@ class SetupController { String usernamePrompt = resourceBundle.getString('login.credentials.username') String username = consoleService.readLine('ilias.credentials.username', usernamePrompt) String passwordPrompt = resourceBundle.getString('login.credentials.password') - String password = consoleService.readPassword('ilias.credentials.password', passwordPrompt) + String namePwPrompt = String.format(passwordPrompt, prefs.userName) + String password = consoleService.readPassword('ilias.credentials.password', namePwPrompt) iliasService.login(new LoginCredentials(username, password)) prefs.userName = username diff --git a/ui/cli/src/main/resources/ilias-cli.properties b/ui/cli/src/main/resources/ilias-cli.properties index c8e17c3..f1c5077 100644 --- a/ui/cli/src/main/resources/ilias-cli.properties +++ b/ui/cli/src/main/resources/ilias-cli.properties @@ -5,7 +5,7 @@ args.sync.max-size=size limit in MiB per file download (exclusive) args.sync.max-size.negative=max download size per item must not be negative: login.credentials.username = Username -login.credentials.password = Password +login.credentials.password = %s's password login.successful = Login succeeded login.error = Login failed diff --git a/ui/cli/src/main/resources/ilias-cli_de.properties b/ui/cli/src/main/resources/ilias-cli_de.properties index 02e72a2..a93c3fe 100644 --- a/ui/cli/src/main/resources/ilias-cli_de.properties +++ b/ui/cli/src/main/resources/ilias-cli_de.properties @@ -5,7 +5,7 @@ args.sync.max-size=maximale Größe der herunterzuladenen Datei in MiB (exklusiv args.sync.max-size.negative=Downloadlimit pro Datei darf nicht negativ sein: login.credentials.username = Benutzername -login.credentials.password = Passwort +login.credentials.password = Passwort von %s login.successful = Login erfolgreich login.error=Login fehlgeschlagen