Merge remote-tracking branch 'origin/stable' into stable
This commit is contained in:
commit
02b578a7ce
@ -457,4 +457,31 @@ public class AccountMgr {
|
||||
String[] priceD = { "1", String.valueOf((int) (price * 100)) };
|
||||
Database.update("price", priceH, priceD);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* update password in User table
|
||||
* @param password User
|
||||
* @return update password
|
||||
* @author Reshad Meher
|
||||
*/
|
||||
protected static long updatePassword( User password) {
|
||||
|
||||
String[] pwH = {"password"};
|
||||
String[] pwD = {password.getPassword()};
|
||||
long updates = Database.update("user",pwH,pwD);
|
||||
return updates;
|
||||
}
|
||||
/**
|
||||
* update adress in User table
|
||||
* @param address Adresss
|
||||
* @return update Adrssse
|
||||
* @author Reshad Meher
|
||||
*/
|
||||
protected static long updateAdreess(Address address ){
|
||||
String[] adH = {"stree","numbrt","plz","city"};
|
||||
String[] adD = {address.getStreet(),address.getNumber(),address.getPlz(),address.getCity()};
|
||||
long updates = Database.update("user",adH,adD);
|
||||
return updates;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,149 @@
|
||||
package com.bib.essensbestellungsverwaltung;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.TextField;
|
||||
|
||||
import java.io.IOException;
|
||||
/**
|
||||
* @author Reshad Meher
|
||||
*/
|
||||
|
||||
public class SettingsController {
|
||||
|
||||
@FXML
|
||||
private TextField tfOldPassword;
|
||||
@FXML
|
||||
private TextField tfNewPassword;
|
||||
@FXML
|
||||
private TextField tfConfirmNewPasword;
|
||||
@FXML
|
||||
private TextField tfPostCode;
|
||||
@FXML
|
||||
private TextField tfStreet;
|
||||
@FXML
|
||||
private TextField tfCity;
|
||||
@FXML
|
||||
private TextField tfHousNumber;
|
||||
|
||||
Alert alert;
|
||||
@FXML
|
||||
private void onPasswordChangClick(){
|
||||
String oldPassword = tfOldPassword.getText();
|
||||
String newPassword = tfNewPassword.getText();
|
||||
String confirmNewPassword = tfConfirmNewPasword.getText();
|
||||
if(!oldPassword.isEmpty() && !newPassword.isEmpty() && !confirmNewPassword.isEmpty()){
|
||||
if(!newPassword.equals(confirmNewPassword)){
|
||||
alert = new Alert(Alert.AlertType.WARNING);
|
||||
alert.setTitle("Passwort");
|
||||
alert.setHeaderText("Ihre neue Passwort und Bestätigung passt nicht. Nochmal versuchen");
|
||||
alert.showAndWait();
|
||||
}else {
|
||||
User userPassword = new User(newPassword);
|
||||
long UpdateUserPassword = AccountMgr.updatePassword(userPassword);
|
||||
if (UpdateUserPassword > 0){
|
||||
alert.setTitle("Passwort");
|
||||
alert.setHeaderText("Ihre Passwort erfolgreich geändert");
|
||||
alert.showAndWait();
|
||||
}
|
||||
else {
|
||||
alert.setTitle("Passwort");
|
||||
alert.setHeaderText("nei");
|
||||
alert.showAndWait();
|
||||
}
|
||||
}
|
||||
|
||||
tfOldPassword.setText("");
|
||||
tfNewPassword.setText("");
|
||||
tfConfirmNewPasword.setText("");
|
||||
}
|
||||
else {
|
||||
if(oldPassword.isEmpty()){
|
||||
alert = new Alert(Alert.AlertType.WARNING);
|
||||
alert.setTitle("Passwort");
|
||||
alert.setHeaderText("Ihre aktuelles Passwort ist leer.");
|
||||
alert.showAndWait();
|
||||
}else if(newPassword.isEmpty()){
|
||||
alert = new Alert(Alert.AlertType.WARNING);
|
||||
alert.setTitle("Passwort");
|
||||
alert.setHeaderText("Ihre neues Passwort ist leer.");
|
||||
alert.showAndWait();
|
||||
}if(confirmNewPassword.isEmpty()){
|
||||
alert = new Alert(Alert.AlertType.WARNING);
|
||||
alert.setTitle("Passwort");
|
||||
alert.setHeaderText("Ihre neue Passwort Bestätigung ist leer.");
|
||||
alert.showAndWait();
|
||||
}else{
|
||||
alert = new Alert(Alert.AlertType.WARNING);
|
||||
alert.setTitle("Passwort");
|
||||
alert.setHeaderText("Ihre Passwort wurde nicht geändert");
|
||||
alert.showAndWait();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void onChangAdressClick(){
|
||||
String postCode = tfPostCode.getText();
|
||||
String street = tfStreet.getText();
|
||||
String city = tfCity.getText();
|
||||
String housNumber = tfHousNumber.getText();
|
||||
if (!postCode.isEmpty() && !street.isEmpty() && !city.isEmpty() && !housNumber.isEmpty()) {
|
||||
Address userAdress = new Address(street,housNumber,postCode,city);
|
||||
long UpdateUserAdress = AccountMgr.updateAdreess(userAdress);
|
||||
if (UpdateUserAdress > 0) {
|
||||
alert.setTitle("Adresse");
|
||||
alert.setHeaderText("Ihre Adresse erfolgreich geändert");
|
||||
alert.showAndWait();
|
||||
|
||||
tfPostCode.setText("");
|
||||
tfStreet.setText("");
|
||||
tfCity.setText("");
|
||||
tfHousNumber.setText("");
|
||||
}
|
||||
|
||||
}else {
|
||||
if (postCode.isEmpty()) {
|
||||
alert = new Alert(Alert.AlertType.WARNING);
|
||||
alert.setTitle("Adresse");
|
||||
alert.setHeaderText("Postleitzahl ist leer.");
|
||||
alert.showAndWait();
|
||||
} else if (street.isEmpty()) {
|
||||
alert = new Alert(Alert.AlertType.WARNING);
|
||||
alert.setTitle("Adresse");
|
||||
alert.setHeaderText("Straß ist leer.");
|
||||
alert.showAndWait();
|
||||
} else if (city.isEmpty()) {
|
||||
alert = new Alert(Alert.AlertType.WARNING);
|
||||
alert.setTitle("Adresse");
|
||||
alert.setHeaderText("Statd ist leer.");
|
||||
alert.showAndWait();
|
||||
} else if (housNumber.isEmpty()) {
|
||||
alert = new Alert(Alert.AlertType.WARNING);
|
||||
alert.setTitle("Adresse");
|
||||
alert.setHeaderText("Hausnumer ist leer.");
|
||||
alert.showAndWait();
|
||||
} else {
|
||||
alert = new Alert(Alert.AlertType.WARNING);
|
||||
alert.setTitle("Adresse");
|
||||
alert.setHeaderText("Ihre Adresse wurde nicht geändert");
|
||||
alert.showAndWait();
|
||||
}
|
||||
}
|
||||
}
|
||||
@FXML
|
||||
private void onLogOutBtClick() throws IOException{
|
||||
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(StartViewApplication.class.getResource("login-view.fxml"));
|
||||
Scene scene = new Scene(fxmlLoader.load(), 950,700);
|
||||
StartViewApplication.primary.setScene(scene);
|
||||
}
|
||||
|
||||
public void onSettingBtClick(ActionEvent actionEvent) {
|
||||
|
||||
}
|
||||
}
|
@ -52,4 +52,13 @@ public class User {
|
||||
public Address getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Reshad Meher
|
||||
*/
|
||||
public User (String password){
|
||||
this.password = password;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,26 @@
|
||||
#contentContainer{
|
||||
-fx-background-color: #add8e6;
|
||||
}
|
||||
|
||||
#contentContainer2{
|
||||
-fx-background-color: lightblue;
|
||||
}
|
||||
|
||||
#contentButton{
|
||||
-fx-background-color: transparent;
|
||||
}
|
||||
|
||||
#contentButton:hover{
|
||||
-fx-underline: true;
|
||||
-fx-background-color: #78939d;
|
||||
-fx-text-fill: white;
|
||||
}
|
||||
|
||||
#btLogOut{
|
||||
-fx-background-color: transparent;
|
||||
-fx-pref-height: 40px;
|
||||
}
|
||||
|
||||
#btLogOut:hover{
|
||||
-fx-underline: true;
|
||||
}
|
@ -0,0 +1,183 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.image.Image?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<AnchorPane prefHeight="800.0" prefWidth="1205.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.bib.essensbestellungsverwaltung.SettingsController">
|
||||
<children>
|
||||
<VBox id="contentContainer" layoutY="-14.0" prefHeight="814.0" prefWidth="333.0" stylesheets="@parentMenue.css">
|
||||
<children>
|
||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="327.0">
|
||||
<children>
|
||||
<ImageView fitHeight="60.0" fitWidth="60.0" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@pics/menu.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
<Button id="contentButton" alignment="BASELINE_LEFT" mnemonicParsing="false" prefHeight="25.0" prefWidth="260.0" text="Essensplan">
|
||||
<font>
|
||||
<Font size="25.0" />
|
||||
</font>
|
||||
</Button>
|
||||
</children>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||
<children>
|
||||
<ImageView fitHeight="60.0" fitWidth="60.0" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@pics/little-kid.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
<Button id="contentButton" alignment="BASELINE_LEFT" mnemonicParsing="false" prefHeight="25.0" prefWidth="260.0" text="Kind">
|
||||
<font>
|
||||
<Font size="25.0" />
|
||||
</font>
|
||||
</Button>
|
||||
</children>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||
<children>
|
||||
<ImageView fitHeight="60.0" fitWidth="60.0" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@pics/shopping-list.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
<Button id="contentButton" alignment="BASELINE_LEFT" mnemonicParsing="false" prefHeight="52.0" prefWidth="260.0" text="Bestellung">
|
||||
<font>
|
||||
<Font size="25.0" />
|
||||
</font>
|
||||
</Button>
|
||||
</children>
|
||||
</HBox>
|
||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0">
|
||||
<children>
|
||||
<ImageView fitHeight="60.0" fitWidth="60.0" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@pics/setting.png" />
|
||||
</image>
|
||||
</ImageView>
|
||||
<Button fx:id="BtSetting" alignment="BASELINE_LEFT" mnemonicParsing="false" onAction="#onSettingBtClick" prefHeight="52.0" prefWidth="260.0" text="Nutzereinstellungen">
|
||||
<font>
|
||||
<Font size="25.0" />
|
||||
</font>
|
||||
</Button>
|
||||
</children>
|
||||
</HBox>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets top="50.0" />
|
||||
</padding></VBox>
|
||||
<HBox id="contentContainer2" alignment="CENTER_RIGHT" prefHeight="40.0" prefWidth="1200.0" stylesheets="@parentMenue.css">
|
||||
<children>
|
||||
<Button mnemonicParsing="false" onAction="#onLogOutBtClick" text="Abmelden" />
|
||||
</children>
|
||||
</HBox>
|
||||
<HBox fx:id="UserSetting" layoutX="343.0" layoutY="48.0" prefHeight="355.0" prefWidth="856.0" style="-fx-border-width: 1 1 1 1; -fx-border-color: lightblue;" AnchorPane.topAnchor="230.0">
|
||||
<children>
|
||||
<VBox prefHeight="353.0" prefWidth="260.0">
|
||||
<children>
|
||||
<Label text="Elterndaten">
|
||||
<font>
|
||||
<Font name="Microsoft Tai Le Bold" size="24.0" />
|
||||
</font>
|
||||
<VBox.margin>
|
||||
<Insets bottom="25.0" left="25.0" right="25.0" top="10.0" />
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
<TextField prefHeight="36.0" prefWidth="274.0" promptText="aktuelles Passwort" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
|
||||
<VBox.margin>
|
||||
<Insets bottom="25.0" left="20.0" right="25.0" top="5.0" />
|
||||
</VBox.margin>
|
||||
<font>
|
||||
<Font name="Microsoft Tai Le Bold" size="16.0" />
|
||||
</font>
|
||||
</TextField>
|
||||
<TextField promptText="neues Passwort" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
|
||||
<VBox.margin>
|
||||
<Insets left="20.0" right="25.0" top="5.0" />
|
||||
</VBox.margin>
|
||||
<font>
|
||||
<Font name="Microsoft Tai Le Bold" size="16.799999237060547" />
|
||||
</font>
|
||||
</TextField>
|
||||
<TextField promptText="passwort bestätigen " style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
|
||||
<VBox.margin>
|
||||
<Insets bottom="25.0" left="20.0" right="25.0" top="25.0" />
|
||||
</VBox.margin>
|
||||
<font>
|
||||
<Font name="Microsoft Tai Le Bold" size="16.799999237060547" />
|
||||
</font>
|
||||
</TextField>
|
||||
<Button alignment="BASELINE_LEFT" contentDisplay="TOP" mnemonicParsing="false" style="-fx-background-radius: 25; -fx-background-color: lightblue;" text="Passowrt ändern" textFill="WHITE">
|
||||
<font>
|
||||
<Font name="Microsoft Tai Le Bold" size="16.799999237060547" />
|
||||
</font>
|
||||
<VBox.margin>
|
||||
<Insets left="80.0" top="25.0" />
|
||||
</VBox.margin>
|
||||
</Button>
|
||||
</children>
|
||||
</VBox>
|
||||
<VBox prefHeight="353.0" prefWidth="245.0">
|
||||
<children>
|
||||
<TextField prefHeight="35.0" prefWidth="102.0" promptText="PLZ" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
|
||||
<VBox.margin>
|
||||
<Insets bottom="25.0" left="20.0" right="25.0" top="75.0" />
|
||||
</VBox.margin>
|
||||
<font>
|
||||
<Font name="Microsoft Tai Le Bold" size="16.0" />
|
||||
</font>
|
||||
</TextField>
|
||||
<TextField promptText="Straße" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
|
||||
<font>
|
||||
<Font name="Microsoft Tai Le Bold" size="16.799999237060547" />
|
||||
</font>
|
||||
<VBox.margin>
|
||||
<Insets bottom="25.0" left="20.0" right="25.0" top="5.0" />
|
||||
</VBox.margin>
|
||||
</TextField>
|
||||
</children>
|
||||
<HBox.margin>
|
||||
<Insets left="80.0" />
|
||||
</HBox.margin>
|
||||
</VBox>
|
||||
<VBox prefHeight="411.0" prefWidth="225.0">
|
||||
<children>
|
||||
<TextField promptText="Stadt" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
|
||||
<VBox.margin>
|
||||
<Insets left="20.0" right="25.0" top="75.0" />
|
||||
</VBox.margin>
|
||||
<font>
|
||||
<Font name="Microsoft Tai Le Bold" size="16.799999237060547" />
|
||||
</font>
|
||||
</TextField>
|
||||
<TextField promptText="Hausnummer" style="-fx-background-color: transparent; -fx-border-color: lightgray; -fx-border-width: 0 0 1 0;">
|
||||
<font>
|
||||
<Font name="Microsoft Tai Le Bold" size="16.799999237060547" />
|
||||
</font>
|
||||
<VBox.margin>
|
||||
<Insets left="25.0" right="25.0" top="25.0" />
|
||||
</VBox.margin>
|
||||
</TextField>
|
||||
<Button alignment="BASELINE_LEFT" contentDisplay="TOP" mnemonicParsing="false" style="-fx-background-radius: 25; -fx-background-color: lightblue;" text="Adresse ändern" textFill="WHITE">
|
||||
<font>
|
||||
<Font name="Microsoft Tai Le Bold" size="16.799999237060547" />
|
||||
</font>
|
||||
<VBox.margin>
|
||||
<Insets left="60.0" top="120.0" />
|
||||
</VBox.margin>
|
||||
</Button>
|
||||
</children>
|
||||
</VBox>
|
||||
</children>
|
||||
</HBox>
|
||||
</children>
|
||||
</AnchorPane>
|
Loading…
Reference in New Issue
Block a user