Remove config based autologin

Fixes #27
This commit is contained in:
Kai S. K. Engelbart 2020-09-18 10:01:57 +02:00
parent f98811c899
commit 89b9afb3db
Signed by: kske
GPG Key ID: 8BEB13EC5DF7EF13
2 changed files with 4 additions and 30 deletions

View File

@ -35,8 +35,6 @@ public final class ClientConfig extends Config {
put("server", "s", identity()); put("server", "s", identity());
put("port", "p", Integer::parseInt); put("port", "p", Integer::parseInt);
put("localDB", "db", File::new); put("localDB", "db", File::new);
put("user", "u", identity());
put("password", "pw", identity());
} }
/** /**
@ -56,28 +54,4 @@ public final class ClientConfig extends Config {
* @since Envoy Client v0.1-alpha * @since Envoy Client v0.1-alpha
*/ */
public File getLocalDB() { return (File) items.get("localDB").get(); } public File getLocalDB() { return (File) items.get("localDB").get(); }
/**
* @return the user name
* @since Envoy Client v0.3-alpha
*/
public String getUser() {
final String user = (String) items.get("user").get();
return user.equals("") ? null : user;
}
/**
* @return the password
* @since Envoy Client v0.3-alpha
*/
public String getPassword() {
final String password = (String) items.get("password").get();
return password.equals("") ? null : password;
}
/**
* @return {@code true} if user name and password are set
* @since Envoy Client v0.3-alpha
*/
public boolean hasLoginCredentials() { return getUser() != null && getPassword() != null; }
} }

View File

@ -79,16 +79,16 @@ public final class Startup extends Application {
localDB.loadIDGenerator(); localDB.loadIDGenerator();
context.setLocalDB(localDB); context.setLocalDB(localDB);
// Configure stage
stage.setTitle("Envoy"); stage.setTitle("Envoy");
stage.getIcons().add(IconUtil.loadIcon("envoy_logo")); stage.getIcons().add(IconUtil.loadIcon("envoy_logo"));
// Create scene context
final var sceneContext = new SceneContext(stage); final var sceneContext = new SceneContext(stage);
context.setSceneContext(sceneContext); context.setSceneContext(sceneContext);
// Perform automatic login if configured // Load login scene
if (config.hasLoginCredentials()) sceneContext.load(SceneInfo.LOGIN_SCENE);
performHandshake(new LoginCredentials(config.getUser(), config.getPassword(), false, Startup.VERSION, loadLastSync(config.getUser())));
else sceneContext.load(SceneInfo.LOGIN_SCENE);
} }
/** /**