2022-01-25 11:14:16 +01:00
|
|
|
//Alex Rechtin//
|
2021-12-20 19:26:07 +01:00
|
|
|
package users;
|
|
|
|
|
2022-01-15 09:24:30 +01:00
|
|
|
import com.jfoenix.controls.*;
|
2021-12-20 19:26:07 +01:00
|
|
|
import javafx.event.ActionEvent;
|
|
|
|
import javafx.fxml.FXML;
|
|
|
|
import javafx.scene.Node;
|
|
|
|
import javafx.scene.control.Label;
|
|
|
|
import javafx.stage.Stage;
|
2022-01-29 12:03:09 +01:00
|
|
|
import container.DataController;
|
2021-12-20 19:26:07 +01:00
|
|
|
|
|
|
|
public class LoginController {
|
|
|
|
@FXML
|
2022-01-31 23:03:29 +01:00
|
|
|
private JFXTextField userField;
|
2021-12-20 19:26:07 +01:00
|
|
|
@FXML
|
2022-01-31 23:03:29 +01:00
|
|
|
private JFXPasswordField passField;
|
2021-12-20 19:26:07 +01:00
|
|
|
@FXML
|
2022-01-31 23:03:29 +01:00
|
|
|
private Label userErrLabel;
|
2021-12-20 19:26:07 +01:00
|
|
|
@FXML
|
2022-01-31 23:03:29 +01:00
|
|
|
private Label passErrLabel;
|
2021-12-20 19:26:07 +01:00
|
|
|
|
|
|
|
@FXML
|
2021-12-22 15:04:15 +01:00
|
|
|
protected void login(ActionEvent event) {
|
|
|
|
if (userField.getText().trim().isEmpty()) {
|
2021-12-21 09:46:53 +01:00
|
|
|
userErrLabel.setText("Bitte Usernamen eingeben!");
|
2021-12-21 08:56:07 +01:00
|
|
|
passErrLabel.setText("");
|
2021-12-20 19:26:07 +01:00
|
|
|
return;
|
|
|
|
}
|
2021-12-22 15:04:15 +01:00
|
|
|
if (passField.getText().trim().isEmpty()) {
|
2021-12-20 19:26:07 +01:00
|
|
|
userErrLabel.setText("");
|
2021-12-21 09:46:53 +01:00
|
|
|
passErrLabel.setText("Bitte Passwort eingeben!");
|
2021-12-20 19:26:07 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
DataController dataController = new DataController();
|
2021-12-22 15:04:15 +01:00
|
|
|
if (!dataController.login(userField.getText(), passField.getText())) {
|
2021-12-20 19:26:07 +01:00
|
|
|
userErrLabel.setText("Name und Passwort passen nicht zueinander!");
|
|
|
|
passErrLabel.setText("Name und Passwort passen nicht zueinander!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
|
|
|
stage.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
@FXML
|
|
|
|
protected void abortBtnClick(ActionEvent event) {
|
|
|
|
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
|
|
|
stage.close();
|
|
|
|
}
|
|
|
|
}
|