Skip to content
Snippets Groups Projects
Commit 97de8168 authored by Syed OMAR's avatar Syed OMAR
Browse files

The edit info window mostly works now

parent 4168e7c6
No related branches found
No related tags found
No related merge requests found
Pipeline #8365 canceled
......@@ -67,13 +67,15 @@ public class DataStorage {
return dataMap.get(generateKey(platform, username));
}
public void updateData(String platform, String username, String newPassword) {
String key = generateKey(platform, username);
if (!dataMap.containsKey(key)) {
throw new EntryNotFoundException("No entry found for platform: " + platform + ", username: " + username);
}
public void updateData(String platform, String username, String newUsername, String newPassword) {
String key = generateKey(platform, newUsername);
// if (!dataMap.containsKey(key)) {
// throw new EntryNotFoundException("No entry found for platform: " + platform + ", username: " + newUsername);
// }
deleteData(platform, username);
dataMap.put(key, new Data(platform, username, Encryption.HashingSalting(newPassword)));
dataMap.put(key, new Data(platform, newUsername, Encryption.HashingSalting(newPassword)));
isDirty = true;
}
......
......@@ -44,7 +44,7 @@ public class EditInfoSceneController {
DataStorage ds = new DataStorage("master_login.json");
// Check if the service exists in the JSON file
Data existingData = ds.getData(platform, newUsername);
Data existingData = ds.getData(platform, username);
if (existingData == null) {
// If the service doesn't exist, show error alert
Alert alert = new Alert(Alert.AlertType.ERROR);
......@@ -56,7 +56,7 @@ public class EditInfoSceneController {
}
// If the service exists, proceed with updating the data
ds.updateData(platform, newUsername, newPassword);
ds.updateData(platform, username, newUsername, newPassword);
ds.saveToJSON();
Alert alert = new Alert(Alert.AlertType.INFORMATION);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment