2023-01-17 15:58:22 +01:00
|
|
|
package com.bib.essensbestellungsverwaltung;
|
|
|
|
|
2023-01-31 12:27:14 +01:00
|
|
|
import javafx.fxml.FXML;
|
|
|
|
import javafx.scene.control.Alert;
|
2023-01-30 14:57:57 +01:00
|
|
|
import javafx.scene.control.PasswordField;
|
|
|
|
import javafx.scene.control.TextField;
|
|
|
|
|
2023-01-17 15:58:22 +01:00
|
|
|
public class AdminController {
|
2023-01-30 14:57:57 +01:00
|
|
|
|
2023-01-31 12:27:14 +01:00
|
|
|
@FXML
|
|
|
|
TextField lastname;
|
|
|
|
@FXML
|
|
|
|
TextField firstname;
|
|
|
|
@FXML
|
|
|
|
TextField street;
|
|
|
|
@FXML
|
|
|
|
TextField number;
|
|
|
|
@FXML
|
|
|
|
TextField city;
|
|
|
|
@FXML
|
|
|
|
TextField plz;
|
|
|
|
@FXML
|
|
|
|
TextField email;
|
|
|
|
@FXML
|
|
|
|
PasswordField password;
|
2023-01-30 14:57:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2023-01-31 12:27:14 +01:00
|
|
|
@FXML
|
2023-01-30 14:57:57 +01:00
|
|
|
protected void onBtSignUp(){
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-01-30 15:03:54 +01:00
|
|
|
|
2023-01-31 12:27:14 +01:00
|
|
|
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);
|
2023-01-30 15:03:54 +01:00
|
|
|
|
|
|
|
AccountMgr.createWorker(worker);
|
2023-01-30 14:57:57 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-01-31 12:27:14 +01:00
|
|
|
@FXML
|
|
|
|
protected void onBtCancel(){
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-01-30 14:57:57 +01:00
|
|
|
|
2023-01-17 15:58:22 +01:00
|
|
|
}
|
2023-01-30 14:57:57 +01:00
|
|
|
|