diff --git a/client/app/src/main/java/main/MainApplication.java b/client/app/src/main/java/main/MainApplication.java index f6987aa..09274f4 100644 --- a/client/app/src/main/java/main/MainApplication.java +++ b/client/app/src/main/java/main/MainApplication.java @@ -23,17 +23,18 @@ public class MainApplication extends Application { System.out.println("Ignore 'Illegal reflective access operation'-Warning. See https://github.com/sshahine/JFoenix/issues/1170"); if( - !config.isLoginSaved() - || new DataController().loginWithToken(config.getId(), config.getToken()) + !config.isSaveLogin() + || !new DataController().loginWithToken(config.getId(), config.getToken()) ){ // Load login-scene loadLoginScene(); } if (DataController.USER_ID >= 0) { - if(config.isLoginSaved()){ + if(config.isSaveLogin()){ config.setId(DataController.USER_ID); config.setToken(HttpRequest.TOKEN); + ConfigLoader.save(config); } // Load main-scene loadMainScene(stage); diff --git a/client/app/src/main/resources/main/main-view.css b/client/app/src/main/resources/main/main-view.css index 684f7b7..0821874 100644 --- a/client/app/src/main/resources/main/main-view.css +++ b/client/app/src/main/resources/main/main-view.css @@ -76,3 +76,29 @@ Label{ -fx-background-color: white; } +.editEventBtn{ + -fx-background-color: transparent; + -fx-border-color: transparent; +} + +.editEventBtn .svg { + -fx-fill: -fill; +} + +.editEventBtn:hover .svg { + -fx-fill: -hover-fill; +} + +.deleteEventBtn{ + -fx-background-color: transparent; + -fx-border-color: transparent; +} + +.deleteEventBtn .svg { + -fx-fill: -fill; +} + +.deleteEventBtn:hover .svg { + -fx-fill: -hover-fill; +} + diff --git a/client/data/src/main/java/config/Config.java b/client/data/src/main/java/config/Config.java index 98401a0..07e8b2f 100644 --- a/client/data/src/main/java/config/Config.java +++ b/client/data/src/main/java/config/Config.java @@ -15,7 +15,7 @@ public class Config { this.token = token; } - public boolean isLoginSaved() { + public boolean isSaveLogin() { return saveLogin; } diff --git a/client/data/src/main/java/res/DataController.java b/client/data/src/main/java/res/DataController.java index 279688a..f920bac 100644 --- a/client/data/src/main/java/res/DataController.java +++ b/client/data/src/main/java/res/DataController.java @@ -62,17 +62,24 @@ public class DataController { return USER_ID >= 0; } - public boolean loginWIthToken(String username, String password) { + public boolean loginWithToken(long userId, String token) { try { + HttpRequest.TOKEN = token; Tuple response = httpRequest.sendPostRequest( LOGIN_WITH_TOKEN_ENDPOINT, - "userId=" + USER_ID, + "userId=" + userId, true ); + + System.out.println(response.getKey() + " " + response.getValue()); + + if(response.getKey() != 200) return false; } catch (Exception e) { e.printStackTrace(); return false; } + USER_ID = userId; + HttpRequest.TOKEN = token; return USER_ID >= 0; }