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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.CheckBox?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.PasswordField?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
@ -32,9 +33,7 @@
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
</Label>
|
||||
<Label alignment="TOP_CENTER" contentDisplay="CENTER"
|
||||
prefHeight="33.0" prefWidth="110.0" text="LOGIN"
|
||||
textAlignment="CENTER">
|
||||
<Label alignment="TOP_CENTER" contentDisplay="CENTER" prefHeight="33.0" prefWidth="110.0" text="LOGIN" textAlignment="CENTER">
|
||||
<font>
|
||||
<Font size="26.0" />
|
||||
</font>
|
||||
@ -92,6 +91,11 @@
|
||||
<Insets bottom="2.0" left="125.0" right="125.0" top="2.0" />
|
||||
</padding>
|
||||
</Button>
|
||||
<CheckBox fx:id="cbStaySignedIn" mnemonicParsing="false" text="Keep me signed in">
|
||||
<VBox.margin>
|
||||
<Insets bottom="10.0" top="10.0" />
|
||||
</VBox.margin>
|
||||
</CheckBox>
|
||||
<HBox alignment="CENTER" prefHeight="30.0" prefWidth="200.0">
|
||||
<children>
|
||||
<Label fx:id="registerTextLabel" text="No account yet?" />
|
||||
|
Reference in New Issue
Block a user