2022-01-10 12:44:27 +01:00
|
|
|
package users;
|
|
|
|
|
2022-01-14 10:52:20 +01:00
|
|
|
import javafx.event.ActionEvent;
|
2022-01-18 12:45:18 +01:00
|
|
|
import javafx.fxml.FXML;
|
2022-01-14 10:52:20 +01:00
|
|
|
import javafx.scene.Node;
|
|
|
|
import javafx.scene.control.Label;
|
2022-01-23 17:33:26 +01:00
|
|
|
import javafx.scene.control.PasswordField;
|
2022-01-10 12:44:27 +01:00
|
|
|
import javafx.scene.control.TextField;
|
2022-01-18 12:45:18 +01:00
|
|
|
import javafx.scene.control.ToggleButton;
|
2022-01-14 10:52:20 +01:00
|
|
|
import javafx.stage.Stage;
|
|
|
|
|
|
|
|
import java.util.Objects;
|
2022-01-10 12:44:27 +01:00
|
|
|
|
|
|
|
public class CreateUserController {
|
|
|
|
|
|
|
|
public TextField textName;
|
2022-01-23 17:33:26 +01:00
|
|
|
public PasswordField textPassword;
|
|
|
|
public PasswordField textPasswordSecond;
|
2022-01-18 12:45:18 +01:00
|
|
|
public ToggleButton checkButtonIsAdmin;
|
|
|
|
public TextField textLogin;
|
|
|
|
public TextField textForename;
|
|
|
|
public Label labelError;
|
2022-01-14 10:52:20 +01:00
|
|
|
|
2022-01-18 12:45:18 +01:00
|
|
|
@FXML
|
2022-01-14 10:52:20 +01:00
|
|
|
protected void createUser(ActionEvent event) {
|
2022-01-18 12:45:18 +01:00
|
|
|
if (textLogin.getText().trim().isEmpty()){
|
|
|
|
labelError.setText("Bitte Login Namen angeben");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (textForename.getText().trim().isEmpty()) {
|
|
|
|
labelError.setText("Bitte Vornamen eingeben!");
|
|
|
|
return;
|
|
|
|
}
|
2022-01-14 10:52:20 +01:00
|
|
|
if (textName.getText().trim().isEmpty()) {
|
2022-01-18 12:45:18 +01:00
|
|
|
labelError.setText("Bitte Nachnamen eingeben!");
|
2022-01-14 10:52:20 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (textPassword.getText().trim().isEmpty()) {
|
2022-01-18 12:45:18 +01:00
|
|
|
labelError.setText("Bitte Passwort eingeben!");
|
2022-01-14 10:52:20 +01:00
|
|
|
return;
|
|
|
|
}
|
2022-01-18 12:45:18 +01:00
|
|
|
if (!Objects.equals(textPassword.getText(), textPasswordSecond.getText())){
|
|
|
|
labelError.setText("Passwörter stimmen nicht überein!");
|
2022-01-14 10:52:20 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
|
|
|
stage.close();
|
|
|
|
}
|
2022-01-18 12:45:18 +01:00
|
|
|
|
|
|
|
@FXML
|
|
|
|
protected void abortBtnClick(ActionEvent event) {
|
|
|
|
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
|
|
|
stage.close();
|
|
|
|
}
|
2022-01-10 12:44:27 +01:00
|
|
|
}
|