Adjust to new LoginCredentials API
This commit is contained in:
parent
3e3d651b87
commit
ae6728fdef
2
pom.xml
2
pom.xml
@ -28,7 +28,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.informatik-ag-ngl</groupId>
|
<groupId>com.github.informatik-ag-ngl</groupId>
|
||||||
<artifactId>envoy-common</artifactId>
|
<artifactId>envoy-common</artifactId>
|
||||||
<version>develop-SNAPSHOT</version>
|
<version>f~password_in_login_credentials-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openjfx</groupId>
|
<groupId>org.openjfx</groupId>
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
package envoy.client.data;
|
package envoy.client.data;
|
||||||
|
|
||||||
|
import static java.util.function.Function.identity;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import envoy.client.ui.Startup;
|
import envoy.client.ui.Startup;
|
||||||
@ -34,15 +35,15 @@ public class ClientConfig extends Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ClientConfig() {
|
private ClientConfig() {
|
||||||
items.put("server", new ConfigItem<>("server", "s", Function.identity(), null, true));
|
items.put("server", new ConfigItem<>("server", "s", identity(), null, true));
|
||||||
items.put("port", new ConfigItem<>("port", "p", Integer::parseInt, null, true));
|
items.put("port", new ConfigItem<>("port", "p", Integer::parseInt, null, true));
|
||||||
items.put("localDB", new ConfigItem<>("localDB", "db", File::new, new File("localDB"), true));
|
items.put("localDB", new ConfigItem<>("localDB", "db", File::new, new File("localDB"), true));
|
||||||
items.put("ignoreLocalDB", new ConfigItem<>("ignoreLocalDB", "nodb", Boolean::parseBoolean, false, false));
|
items.put("ignoreLocalDB", new ConfigItem<>("ignoreLocalDB", "nodb", Boolean::parseBoolean, false, false));
|
||||||
items.put("homeDirectory", new ConfigItem<>("homeDirectory", "h", File::new, new File(System.getProperty("user.home"), ".envoy"), true));
|
items.put("homeDirectory", new ConfigItem<>("homeDirectory", "h", File::new, new File(System.getProperty("user.home"), ".envoy"), true));
|
||||||
items.put("fileLevelBarrier", new ConfigItem<>("fileLevelBarrier", "fb", Level::parse, Level.CONFIG, true));
|
items.put("fileLevelBarrier", new ConfigItem<>("fileLevelBarrier", "fb", Level::parse, Level.CONFIG, true));
|
||||||
items.put("consoleLevelBarrier", new ConfigItem<>("consoleLevelBarrier", "cb", Level::parse, Level.FINEST, true));
|
items.put("consoleLevelBarrier", new ConfigItem<>("consoleLevelBarrier", "cb", Level::parse, Level.FINEST, true));
|
||||||
items.put("user", new ConfigItem<>("user", "u", Function.identity()));
|
items.put("user", new ConfigItem<>("user", "u", identity()));
|
||||||
items.put("password", new ConfigItem<>("password", "pw", String::toCharArray));
|
items.put("password", new ConfigItem<>("password", "pw", identity()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -97,7 +98,7 @@ public class ClientConfig extends Config {
|
|||||||
* @return the password
|
* @return the password
|
||||||
* @since Envoy Client v0.3-alpha
|
* @since Envoy Client v0.3-alpha
|
||||||
*/
|
*/
|
||||||
public char[] getPassword() { return (char[]) items.get("password").get(); }
|
public String getPassword() { return (String) items.get("password").get(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@code true} if user name and password are set
|
* @return {@code true} if user name and password are set
|
||||||
|
@ -131,14 +131,13 @@ public final class LoginScene {
|
|||||||
} else if (!Bounds.isValidContactName(userTextField.getTextField().getText())) {
|
} else if (!Bounds.isValidContactName(userTextField.getTextField().getText())) {
|
||||||
new Alert(AlertType.ERROR, "The entered user name is not valid (" + Bounds.CONTACT_NAME_PATTERN + ")").showAndWait();
|
new Alert(AlertType.ERROR, "The entered user name is not valid (" + Bounds.CONTACT_NAME_PATTERN + ")").showAndWait();
|
||||||
userTextField.getTextField().clear();
|
userTextField.getTextField().clear();
|
||||||
} else performHandshake(new LoginCredentials(userTextField.getTextField().getText(), passwordField.getText().toCharArray(),
|
} else performHandshake(new LoginCredentials(userTextField.getTextField().getText(), passwordField.getText(), registerCheckBox.isSelected(),
|
||||||
registerCheckBox.isSelected(), Startup.VERSION));
|
Startup.VERSION));
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void offlineModeButtonPressed() {
|
private void offlineModeButtonPressed() {
|
||||||
attemptOfflineMode(
|
attemptOfflineMode(new LoginCredentials(userTextField.getTextField().getText(), passwordField.getText(), false, Startup.VERSION));
|
||||||
new LoginCredentials(userTextField.getTextField().getText(), passwordField.getText().toCharArray(), false, Startup.VERSION));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
Reference in New Issue
Block a user