2023-01-31 07:41:21 +01:00

44 lines
1.3 KiB
Java

/*Richard Reiswich*/
package com.bib.essensbestellungsverwaltung;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import java.io.IOException;
import java.util.HashMap;
public class LoginController {
@FXML
private TextField tfEmail;
@FXML
private PasswordField pfPassword;
HashMap<String,String> benutzerMap = new HashMap<String,String>();
@FXML
protected void onBtLoginClick() throws IOException {
benutzerMap.put("Reshad","1234");
String email = tfEmail.getText();
String password = pfPassword.getText();
if(benutzerMap.containsKey(email) && benutzerMap.containsValue(password)){
// if user is worker: StartViewApplication.changeScene("workerMenu-view.fxml");
StartViewApplication.changeScene("parentMenu-view.fxml");
}else {
Alert alert = new Alert(Alert.AlertType.ERROR,"Email oder Passwort ist falsch");
alert.showAndWait();
}
tfEmail.setText("");
pfPassword.setText("");
}
@FXML
protected void changeToSignUp() throws IOException {
StartViewApplication.changeScene("signUp-view.fxml");
}
}