From c87d73ec57cdbdb50dc27bf1c64c7fbbf55e9812 Mon Sep 17 00:00:00 2001 From: mikkomaa Date: Wed, 22 Jun 2016 13:55:46 +0300 Subject: [PATCH] Ask server first from user in login --- README.md | 4 ++-- .../java/fi/helsinki/cs/tmc/cli/command/LoginCommand.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e6010cd8..025c19db 100644 --- a/README.md +++ b/README.md @@ -46,9 +46,9 @@ Now that you've installed tmc-cli, you can view all available commands by runnin Once installation is complete, you can log in using `tmc login`. This saves your TMC login information to a configuration file in ~/.config/tmc-cli/ (or %LOCALAPPDATA% on Windows) - you will only have to log in once. ``` ~ $ tmc login -username: my-username -password: server address: +username: +password: Login successful. ``` diff --git a/src/main/java/fi/helsinki/cs/tmc/cli/command/LoginCommand.java b/src/main/java/fi/helsinki/cs/tmc/cli/command/LoginCommand.java index c35a8f85..9192cb22 100644 --- a/src/main/java/fi/helsinki/cs/tmc/cli/command/LoginCommand.java +++ b/src/main/java/fi/helsinki/cs/tmc/cli/command/LoginCommand.java @@ -36,10 +36,10 @@ public void getOptions(Options options) { @Override public void run(CommandLine args, Io io) { this.io = io; + String serverAddress = getLoginInfo(args, "s", "server address: "); String username = getLoginInfo(args, "u", "username: "); String password = getLoginInfo(args, "p", "password: "); - String serverAddress = getLoginInfo(args, "s", "server address: "); - + Settings settings = new Settings(serverAddress, username, password); if (loginPossible(settings) && saveLoginSettings(settings)) { io.println("Login successful.");