Skip to content

Commit 07df243

Browse files
committed
#165: Clean Code
1 parent 4fa51be commit 07df243

File tree

1 file changed

+9
-35
lines changed

1 file changed

+9
-35
lines changed

src/main/java/de/doubleslash/keeptime/view/SettingsController.java

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,15 @@
6161

6262
@Component
6363
public class SettingsController {
64-
6564
@FXML
6665
private ColorPicker hoverBackgroundColor;
66+
6767
@FXML
6868
private ColorPicker hoverFontColor;
6969

7070
@FXML
7171
private ColorPicker defaultBackgroundColor;
72+
7273
@FXML
7374
private ColorPicker defaultFontColor;
7475

@@ -77,21 +78,28 @@ public class SettingsController {
7778

7879
@FXML
7980
private Button resetHoverBackgroundButton;
81+
8082
@FXML
8183
private Button resetHoverFontButton;
84+
8285
@FXML
8386
private Button resetDefaultBackgroundButton;
87+
8488
@FXML
8589
private Button resetDefaultFontButton;
90+
8691
@FXML
8792
private Button resetTaskBarFontButton;
8893

8994
@FXML
9095
private CheckBox useHotkeyCheckBox;
96+
9197
@FXML
9298
private CheckBox displayProjectsRightCheckBox;
99+
93100
@FXML
94101
private CheckBox hideProjectsOnMouseExitCheckBox;
102+
95103
@FXML
96104
private CheckBox saveWindowPositionCheckBox;
97105

@@ -193,15 +201,6 @@ public class SettingsController {
193201
private String username;
194202
private String password;
195203

196-
@FXML
197-
private Label labelPassword;
198-
199-
@FXML
200-
private Label labelPort;
201-
202-
@FXML
203-
private Label labelUsername;
204-
205204
@Autowired
206205
ViewController mainscreen;
207206

@@ -210,24 +209,9 @@ public SettingsController(final Model model, final Controller controller,
210209
this.model = model;
211210
this.controller = controller;
212211
this.applicationProperties = applicationProperties;
213-
// setDefaultUserAndPassword();
214212

215213
}
216214

217-
private void setDefaultUserAndPassword() {
218-
219-
username = authName.getText();
220-
password = authPassword.getText();
221-
222-
createAndSaveUser(username, password);
223-
224-
Properties properties = new Properties();
225-
// System.setProperty("BASIC_AUTH_USER", "admin");
226-
// System.setProperty("BASIC_AUTH_PASSWORD", "123");
227-
properties.put("spring.security.user.name", "${BASIC_AUTH_USER:" + "admin" + "}");
228-
properties.put("spring.security.user.password", "${BASIC_AUTH_PASSWORD:" + "admin" + "}");
229-
}
230-
231215
@FXML
232216
private void initialize() {
233217
LOG.debug("start init");
@@ -270,10 +254,6 @@ private void initialize() {
270254
radioApiOn.setSelected(true);
271255
radioApiOff.setSelected(false);
272256
String port = properties.getProperty("server.port");
273-
274-
// if (user != null) {
275-
// authName.setText(user.getUserName());
276-
// }
277257
if (port != null) {
278258
authPort.setText(port);
279259
}
@@ -653,11 +633,8 @@ private void handleApiOn() {
653633
propertiesToUpdate.put("server.port", authPort.getText());
654634
propertiesToUpdate.put("api", "ON");
655635

656-
// propertiesToUpdate.put("authUsername", username);
657636
propertiesToUpdate.put("spring.security.user.name", "${BASIC_AUTH_USER:" + username + "}");
658637
propertiesToUpdate.put("spring.security.user.password", "${BASIC_AUTH_PASSWORD:" + password + "}");
659-
// System.setProperty("BASIC_AUTH_USER", username);
660-
// System.setProperty("BASIC_AUTH_PASSWORD", password);
661638
propertyWrite(propertiesToUpdate);
662639
}
663640

@@ -669,9 +646,6 @@ private void createAndSaveUser(String username, String password) {
669646
Properties properties = new Properties();
670647
properties.setProperty("spring.security.user.name", "${BASIC_AUTH_USER:" + username + "}");
671648
properties.setProperty("spring.security.user.password", "${BASIC_AUTH_PASSWORD:" + password + "}");
672-
// System.setProperty("BASIC_AUTH_USER", username);
673-
// System.setProperty("BASIC_AUTH_PASSWORD", password);
674-
675649
}
676650

677651
private void propertyWrite(String key, String value) {

0 commit comments

Comments
 (0)