Skip to content

Commit

Permalink
edited some stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
h-hafezi committed Jul 23, 2020
1 parent c3d6e5c commit b76612b
Show file tree
Hide file tree
Showing 5 changed files with 192 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/main/java/Controller/Security/Security.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public static void securityCheck(String command, Socket socket) throws ParseExce

if (token.equals("no token")) {
if (username.equals("no username")) {
Server.server.takeAction(command);
Server.server.takeActionNotSecure(message);
return;
} else {
blackListOfIPs.add(getIP(socket));
Expand Down
179 changes: 179 additions & 0 deletions src/main/java/Controller/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,185 @@ else if (command.startsWith("show balance")) {

}

public void takeActionNotSecure(String command) throws ParseException {
Matcher matcher;
if ((matcher = getMatcher("login\\+(\\w+)\\+(\\w+)", command)).find()) {
this.login(matcher);
} else if (command.startsWith("register+")) {
this.register(command);
} else if (command.startsWith("what is account role+")) {
this.getAccountRole(command);
} else if (command.startsWith("show accounts+")) {
this.showAccounts(command);
} else if (command.startsWith("view account info+")) {
this.viewAccountInfo(command);
} else if (command.startsWith("see authorization+")) {
this.seeAuthorization(command);
} else if (command.startsWith("delete account+")) {
this.deleteAccount(command);
} else if (command.startsWith("search account+")) {
this.searchAccount(command);
} else if (command.startsWith("make new boss+")) {
this.makeNewBoss(command);
} else if (command.startsWith("show requests+")) {
this.showRequests(command);
} else if (command.startsWith("request username show+")) {
this.requestUsername(command);
} else if (command.startsWith("view request+")) {
this.viewRequest(command);
} else if (command.startsWith("is request state checking+")) {
this.isRequestStateChecking(command);
} else if (command.startsWith("is account requestable+")) {
this.isAccountRequestable(command);
} else if (command.startsWith("search request+")) {
this.searchRequest(command);
} else if (command.startsWith("accept request+")) {
this.acceptRequest(command);
} else if (command.startsWith("decline request+")) {
this.declineRequest(command);
} else if (command.startsWith("delete request+")) {
this.deleteRequest(command);
} else if (command.startsWith("what is request username+")) {
this.getRequestAccountUsername(command);
} else if (command.startsWith("what is request object ID+")) {
this.getRequestObjectID(command);
} else if (command.startsWith("show categories+")) {
this.showCategories(command);
} else if (command.startsWith("view category+")) {
this.viewCategory(command);
} else if (command.startsWith("search category+")) {
this.searchCategory(command);
} else if (command.startsWith("is category exists+")) {
this.isCategoryExists(command);
} else if (command.startsWith("what is category attribute+")) {
this.whatIsCategoryAttribute(command);
} else if (command.startsWith("add category attribute+")) {
this.addCategoryAttribute(command);
} else if (command.startsWith("product picture path+")) {
this.addProductPicturePath(command);
} else if (command.startsWith("get product picture path+")) {
this.getProfilePicturePath(command);
}else if (command.startsWith("show products+")) {
this.showProducts(command);
} else if (command.startsWith("show my products+")) {
this.showMyProducts(command);
} else if (command.startsWith("view product+")) {
this.viewProduct(command);
} else if (command.startsWith("add product+")) {
this.addProduct(command);
} else if (command.startsWith("delete product+")) {
this.deleteProduct(command);
} else if (command.startsWith("search product+")) {
this.searchProduct(command);
} else if (command.startsWith("edit product price+")) {
this.editProductPrice(command);
} else if (command.startsWith("add product remainder+")) {
this.addProductRemainder(command);
} else if (command.startsWith("decrease product remainder")) {
this.decreaseProductRemainder(command);
} else if (command.startsWith("edit product+")) {
this.editProduct(command);
} else if (command.startsWith("what is product category+")) {
this.whatIsProductCategory(command);
} else if (command.startsWith("add product view+")) {
this.addProductView(command);
} else if (command.startsWith("add product category+")) {
this.addProductCategory(command);
} else if (command.startsWith("delete product salesman+")) {
this.deleteProductSalesman(command);
} else if (command.startsWith("search offCod")) {
this.searchOffCode(command);
} else if (command.startsWith("can add to offCode")) {
this.canAddUserToOffCode(command);
} else if (command.startsWith("get all offCodeAble user")) {
this.getAllOffCodeAbleUser(command);
} else if (command.startsWith("view offCode")) {
this.viewOffCode(command);
} else if (command.startsWith("show offCodes")) {
this.showOffCodes(command);
} else if (command.startsWith("create new sale")) {
this.createSale(command);
} else if (command.startsWith("can add product to sale")) {
this.canAddProductToSale(command);
} else if (command.startsWith("search sale")) {
this.searchSale(command);
} else if (command.startsWith("view sale")) {
this.viewSale(command);
} else if (command.startsWith("show sales")) {
this.showSales(command);
} else if (command.startsWith("what is comment product ID+")) {
this.getCommentProductID(command);
} else if (command.startsWith("comment product+")) {
this.commentProduct(command);
} else if (command.startsWith("point product+")) {
this.pointProduct(command);
} else if (command.startsWith("what is point product+")) {
this.getProductPoint(command);
} else if (command.startsWith("is server has boss")) {
this.isServerHasBoss();
} else if (command.startsWith("get product min price+")) {
this.getMinPrice(command);
} else if (command.startsWith("get product sellers+")) {
this.getProductSellers(command);
} else if (command.startsWith("show the salesman+")) {
this.showSalesman(command);
} else if (command.startsWith("get product video+")) {
this.getProductVideo(command);
} else if (command.startsWith("set product video+")) {
this.setProductVideo(command);
} else if (command.startsWith("set person image+")) {
this.setPersonImage(command);
} else if (command.startsWith("get person image+")) {
this.getPersonImage(command);
} else if (command.startsWith("delete person image")) {
this.deletePersonImage(command);
} else if (command.startsWith("what is product name+")) {
this.getProductName(command);
} else if (command.startsWith("is product on sale by+")) {
this.getProductOnSale(command);
} else if (command.startsWith("get product price by salesman+")) {
this.getProductPrice(command);
} else if (command.startsWith("is product finished+")) {
isFinished(command);
} else if (command.startsWith("is product on sale+")) {
isOnSale(command);
} else if (command.startsWith("product min price with name+")) {
getMinPriceWithName(command);
} else if (command.startsWith("is there product name+")) {
isThereProductName(command);
} else if (command.startsWith("similar product+")) {
similarProduct(command);
} else if (command.startsWith("commercial+")) {
commercial(command);
} else if (command.startsWith("get all commercial")) {
getAllCommercials();
} else if (command.startsWith("get product sale")) {
getProductSale(command);
}
//supporter parts
else if (command.startsWith("get all online supporters")) {
getAllOnlineSupporters();
} else if (command.startsWith("send message to supporter")) {
sendMessage(command);
}
//end parts
else if (command.startsWith("show balance")) {
this.showBalance(command);
} else if (command.startsWith("add balance+")) {
this.addBalance(command);
} else if (command.startsWith("Add To Cart+")) {
this.addToCart(command);
} else if (command.startsWith("get money+")) {
this.getMoney(command);
} else if (command.startsWith("buy+")) {
this.buy(command);
} else if (command.startsWith("can use offCode+")) {
this.canUserOffCode(command);
}

}


private void getAllOnlineSupporters() {
setAnswer("Javad" + "\n" + "Matin" + "\n" + "hossein");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.Cursor?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?>

<AnchorPane prefHeight="564.0" prefWidth="721.0" style="-fx-background-color: DodgerBlue;" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="GUI.BossProfile.ManagerUsersMenu.OnlineUsers.OnlineUser">
<AnchorPane prefHeight="564.0" prefWidth="721.0" style="-fx-background-color: DodgerBlue;" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="GUI.BossProfile.ManagerUsersMenu.OnlineUsers.OnlineUser">
<children>
<ScrollPane layoutX="29.0" layoutY="107.0" opacity="0.83" prefHeight="417.0" prefWidth="661.0">
<content>
Expand All @@ -31,6 +28,9 @@
<ImageView fitHeight="47.0" fitWidth="60.0" layoutX="600.0" layoutY="8.0" onMouseClicked="#refresh" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@blue-refresh-icon-29.jpg" />
</image></ImageView>
</image>
<cursor>
<Cursor fx:constant="HAND" />
</cursor></ImageView>
</children>
</AnchorPane>
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public void initialize() throws ParseException, IOException {
}

public void refresh(MouseEvent mouseEvent) throws IOException, ParseException {
Audio.playClick5();
box.getChildren().clear();
initialize();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/GUI/ProductScene/ProductSceneController.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public void initialize() throws ParseException, IOException {
}
Platform.runLater(() -> {
try {
Stage stage = MenuHandler.getStage();
Stage stage = (Stage) accountMenuButton.getScene().getWindow();
Popup popup = new Popup();
HBox root = FXMLLoader.load(getClass().getResource("/GUI/Supporter/SupporterPopUp.fxml"));
popup.getContent().add(root);
Expand Down

0 comments on commit b76612b

Please sign in to comment.