Add token request to login credentials and "Stay Signed In" checkbox
This commit is contained in:
@ -46,6 +46,9 @@ public final class LoginScene implements EventListener {
|
||||
@FXML
|
||||
private Button loginButton;
|
||||
|
||||
@FXML
|
||||
private CheckBox cbStaySignedIn;
|
||||
|
||||
@FXML
|
||||
private Button offlineModeButton;
|
||||
|
||||
@ -55,7 +58,7 @@ public final class LoginScene implements EventListener {
|
||||
@FXML
|
||||
private ImageView logo;
|
||||
|
||||
private boolean registration = false;
|
||||
private boolean registration;
|
||||
|
||||
private static final Logger logger = EnvoyLog.getLogger(LoginScene.class);
|
||||
private static final ClientConfig config = ClientConfig.getInstance();
|
||||
@ -76,6 +79,7 @@ public final class LoginScene implements EventListener {
|
||||
@FXML
|
||||
private void loginButtonPressed() {
|
||||
final String user = userTextField.getText(), pass = passwordField.getText(), repeatPass = repeatPasswordField.getText();
|
||||
final boolean requestToken = cbStaySignedIn.isSelected();
|
||||
|
||||
// Prevent registration with unequal passwords
|
||||
if (registration && !pass.equals(repeatPass)) {
|
||||
@ -86,8 +90,8 @@ public final class LoginScene implements EventListener {
|
||||
userTextField.clear();
|
||||
} else {
|
||||
Instant lastSync = Startup.loadLastSync(userTextField.getText());
|
||||
Startup.performHandshake(registration ? LoginCredentials.registration(user, pass, Startup.VERSION, lastSync)
|
||||
: LoginCredentials.login(user, pass, Startup.VERSION, lastSync));
|
||||
Startup.performHandshake(registration ? LoginCredentials.registration(user, pass, requestToken, Startup.VERSION, lastSync)
|
||||
: LoginCredentials.login(user, pass, requestToken, Startup.VERSION, lastSync));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user