2023-02-01 10:14:17 +01:00

43 lines
1.4 KiB
Java

/*Reshad Meher*/
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 java.io.IOException;
public class LoginController {
@FXML
private TextField tfEmail;
@FXML
private PasswordField pfPassword;
@FXML
protected void onBtLoginClick() throws IOException {
String email = tfEmail.getText();
String password = pfPassword.getText();
long loginPruefen = AccountMgr.login(email,password);
if(loginPruefen > 0){
FXMLLoader fxmlLoader = new FXMLLoader(StartViewApplication.class.getResource("menue-view.fxml"));
Scene scene = new Scene(fxmlLoader.load(), 950,700);
StartViewApplication.primary.setScene(scene);
}else {
Alert alert = new Alert(Alert.AlertType.ERROR,"Email oder Passwort ist falsch");
alert.showAndWait();
}
tfEmail.setText("");
pfPassword.setText("");
}
@FXML
protected void onBtSingnupClick() throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(StartViewApplication.class.getResource("signUp-view.fxml"));
Scene scene = new Scene(fxmlLoader.load(), 950,700);
StartViewApplication.primary.setScene(scene);
}
}