Admin Controller bearbeitet
This commit is contained in:
parent
0550482a6b
commit
1a9f13581e
@ -1,43 +1,81 @@
|
|||||||
package com.bib.essensbestellungsverwaltung;
|
package com.bib.essensbestellungsverwaltung;
|
||||||
|
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.Alert;
|
||||||
import javafx.scene.control.PasswordField;
|
import javafx.scene.control.PasswordField;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
|
|
||||||
public class AdminController {
|
public class AdminController {
|
||||||
|
|
||||||
private TextField lastname;
|
@FXML
|
||||||
private TextField firstname;
|
TextField lastname;
|
||||||
private TextField street;
|
@FXML
|
||||||
private TextField number;
|
TextField firstname;
|
||||||
private TextField city;
|
@FXML
|
||||||
private TextField plz;
|
TextField street;
|
||||||
private TextField email;
|
@FXML
|
||||||
private PasswordField password;
|
TextField number;
|
||||||
|
@FXML
|
||||||
|
TextField city;
|
||||||
|
@FXML
|
||||||
|
TextField plz;
|
||||||
|
@FXML
|
||||||
|
TextField email;
|
||||||
|
@FXML
|
||||||
|
PasswordField password;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@FXML
|
||||||
protected void onBtSignUp(){
|
protected void onBtSignUp(){
|
||||||
|
|
||||||
String ln = lastname.toString();
|
|
||||||
String fn = firstname.toString();
|
|
||||||
String st = street.toString();
|
|
||||||
String nr = number.toString();
|
|
||||||
String cityString = city.toString();
|
|
||||||
String plzString = plz.toString();
|
|
||||||
String emailString = email.toString();
|
|
||||||
String pw = password.toString();
|
|
||||||
|
|
||||||
String[] userData = new String[]{ln,fn,pw,emailString};
|
|
||||||
String[] addressData = new String[]{st,nr,plzString,cityString};
|
|
||||||
|
|
||||||
Address adresse = new Address(st,nr,plzString,cityString);
|
|
||||||
|
|
||||||
Worker worker = new Worker(ln,fn,pw,emailString,adresse);
|
String ln = lastname.getText();
|
||||||
|
String fn = firstname.getText();
|
||||||
|
String st = street.getText();
|
||||||
|
String nr = number.getText();
|
||||||
|
String cityString = city.getText();
|
||||||
|
String plzString = plz.getText();
|
||||||
|
String emailString = email.getText();
|
||||||
|
String pw = password.getText();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(!pw.matches("^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=])(?=\\S+$).{8,}$")){
|
||||||
|
|
||||||
|
Alert alert = new Alert(Alert.AlertType.ERROR);
|
||||||
|
alert.setTitle("Passwort");
|
||||||
|
alert.setHeaderText("Ungültiges Passwort");
|
||||||
|
alert.setContentText("Das Passwort benötigt mindestens: \n-8 Zeichen\n-einen Kleinbuchstaben\n-einen Großbuchstaben\n-ein Sonderzeichen\n-kein Leerzeichen");
|
||||||
|
password.setText("");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!emailString.matches("^(?=.{1,64}@)[A-Za-z0-9_-]+(\\\\.[A-Za-z0-9_-]+)*@[^-][A-Za-z0-9-]+(\\\\.[A-Za-z0-9-]+)*(\\\\.[A-Za-z]{2,})$")){
|
||||||
|
Alert alert = new Alert(Alert.AlertType.ERROR);
|
||||||
|
alert.setTitle("E-Mail");
|
||||||
|
alert.setHeaderText("Ungültige E-Mail Adresse");
|
||||||
|
alert.setContentText("Bitte geben sie eine gültige E-Mail Adresse an");
|
||||||
|
email.setText("");
|
||||||
|
}
|
||||||
|
|
||||||
|
//String[] userData = new String[]{ln,fn,pw,emailString};
|
||||||
|
//String[] addressData = new String[]{st,nr,plzString,cityString};
|
||||||
|
|
||||||
|
Address address = new Address(st,nr,plzString,cityString);
|
||||||
|
|
||||||
|
Worker worker = new Worker(ln,fn,pw,emailString,address);
|
||||||
|
|
||||||
AccountMgr.createWorker(worker);
|
AccountMgr.createWorker(worker);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
protected void onBtCancel(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.Button?>
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
|
<?import javafx.scene.control.PasswordField?>
|
||||||
<?import javafx.scene.control.TextField?>
|
<?import javafx.scene.control.TextField?>
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
<?import javafx.scene.layout.HBox?>
|
<?import javafx.scene.layout.HBox?>
|
||||||
@ -141,16 +142,16 @@
|
|||||||
<Insets top="10.0" />
|
<Insets top="10.0" />
|
||||||
</padding>
|
</padding>
|
||||||
</Label>
|
</Label>
|
||||||
<TextField id="password" accessibleRole="PASSWORD_FIELD" prefHeight="25.0" prefWidth="194.0">
|
<PasswordField id="password" accessibleRole="PASSWORD_FIELD" prefHeight="25.0" prefWidth="194.0">
|
||||||
<HBox.margin>
|
<HBox.margin>
|
||||||
<Insets top="10.0" />
|
<Insets top="10.0" />
|
||||||
</HBox.margin>
|
</HBox.margin>
|
||||||
</TextField>
|
</PasswordField>
|
||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
</children>
|
</children>
|
||||||
</VBox>
|
</VBox>
|
||||||
<Button id="btCreateCoworker" layoutX="216.0" layoutY="533.0" mnemonicParsing="false" prefHeight="44.0" prefWidth="158.0" text="Mitarbeiter hinzufügen" />
|
<Button id="btCreateCoworker" fx:id="btCreateCoworker" layoutX="216.0" layoutY="533.0" mnemonicParsing="false" onAction="#onBtSignUp" prefHeight="44.0" prefWidth="158.0" text="Mitarbeiter hinzufügen" />
|
||||||
<Button id="btCancelCoworker" layoutX="443.0" layoutY="533.0" mnemonicParsing="false" prefHeight="44.0" prefWidth="158.0" text="Abbrechen" />
|
<Button id="btCancelCoworker" fx:id="btCancelCoworker" layoutX="443.0" layoutY="533.0" mnemonicParsing="false" onAction="#onBtCancel" prefHeight="44.0" prefWidth="158.0" text="Abbrechen" />
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
|
Loading…
Reference in New Issue
Block a user