2022-01-10 12:44:27 +01:00
|
|
|
package users;
|
|
|
|
|
2022-01-14 10:52:20 +01:00
|
|
|
import javafx.event.ActionEvent;
|
|
|
|
import javafx.scene.Node;
|
2022-01-10 12:44:27 +01:00
|
|
|
import javafx.scene.control.CheckBox;
|
2022-01-14 10:52:20 +01:00
|
|
|
import javafx.scene.control.Label;
|
2022-01-10 12:44:27 +01:00
|
|
|
import javafx.scene.control.TextField;
|
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;
|
|
|
|
public TextField textPassword;
|
|
|
|
public TextField textPasswordSecond;
|
|
|
|
public CheckBox checkBoxIsAdmin;
|
2022-01-14 10:52:20 +01:00
|
|
|
public Label labelErrorName;
|
|
|
|
public Label labelErrorPw;
|
|
|
|
|
|
|
|
protected void createUser(ActionEvent event) {
|
|
|
|
if (textName.getText().trim().isEmpty()) {
|
|
|
|
labelErrorName.setText("Bitte Usernamen eingeben!");
|
|
|
|
labelErrorPw.setText("");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (textPassword.getText().trim().isEmpty()) {
|
|
|
|
labelErrorName.setText("");
|
|
|
|
labelErrorPw.setText("Bitte Passwort eingeben!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (Objects.equals(textPassword.getText(), textPasswordSecond.getText())){
|
|
|
|
labelErrorName.setText("");
|
|
|
|
labelErrorPw.setText("Passwörter stimmen nicht überein!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
|
|
|
stage.close();
|
|
|
|
}
|
2022-01-10 12:44:27 +01:00
|
|
|
}
|