Updated create-user, css and the controller

This commit is contained in:
2022-01-18 12:45:18 +01:00
parent 7c8b1fefb7
commit 6e6183bf38
3 changed files with 111 additions and 26 deletions

View File

@@ -1,10 +1,11 @@
package users;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.control.ToggleButton;
import javafx.stage.Stage;
import java.util.Objects;
@@ -14,28 +15,41 @@ public class CreateUserController {
public TextField textName;
public TextField textPassword;
public TextField textPasswordSecond;
public CheckBox checkBoxIsAdmin;
public Label labelErrorName;
public Label labelErrorPw;
public ToggleButton checkButtonIsAdmin;
public TextField textLogin;
public TextField textForename;
public Label labelError;
@FXML
protected void createUser(ActionEvent event) {
if (textLogin.getText().trim().isEmpty()){
labelError.setText("Bitte Login Namen angeben");
return;
}
if (textForename.getText().trim().isEmpty()) {
labelError.setText("Bitte Vornamen eingeben!");
return;
}
if (textName.getText().trim().isEmpty()) {
labelErrorName.setText("Bitte Usernamen eingeben!");
labelErrorPw.setText("");
labelError.setText("Bitte Nachnamen eingeben!");
return;
}
if (textPassword.getText().trim().isEmpty()) {
labelErrorName.setText("");
labelErrorPw.setText("Bitte Passwort eingeben!");
labelError.setText("Bitte Passwort eingeben!");
return;
}
if (Objects.equals(textPassword.getText(), textPasswordSecond.getText())){
labelErrorName.setText("");
labelErrorPw.setText("Passwörter stimmen nicht überein!");
if (!Objects.equals(textPassword.getText(), textPasswordSecond.getText())){
labelError.setText("Passwörter stimmen nicht überein!");
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();
}
}