|
|
@ -120,10 +120,31 @@ public class Vault implements VaultInterface { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void editCredential(int newID, String newString, boolean decision) { |
|
|
|
if(decision == true){ |
|
|
|
public void editCredential() { |
|
|
|
Scanner scan = new Scanner(inputS); |
|
|
|
|
|
|
|
println("Type ID to select credential:"); |
|
|
|
newID = Integer.parseInt(scan.nextLine()); |
|
|
|
|
|
|
|
println("-change username: u\n-change password: p"); |
|
|
|
|
|
|
|
String input = scan.nextLine(); |
|
|
|
|
|
|
|
if (input.equals("u")) { |
|
|
|
decision = true; |
|
|
|
} |
|
|
|
|
|
|
|
if(decision){ |
|
|
|
|
|
|
|
println("Type new username:"); |
|
|
|
newString = scan.nextLine(); |
|
|
|
|
|
|
|
credentialRepository.updateUsername(newID, newString); |
|
|
|
} else { |
|
|
|
|
|
|
|
println("Type new password:"); |
|
|
|
newString = scan.nextLine(); |
|
|
|
|
|
|
|
credentialRepository.updatePassword(newID, newString); |
|
|
|
} |
|
|
|
} |
|
|
@ -201,18 +222,7 @@ public class Vault implements VaultInterface { |
|
|
|
break; |
|
|
|
|
|
|
|
case "l": |
|
|
|
println("Type ID to select credential:"); |
|
|
|
newID = Integer.parseInt(scan.nextLine()); |
|
|
|
println("-change username: u\n-change password: p"); |
|
|
|
|
|
|
|
input = scan.nextLine(); |
|
|
|
|
|
|
|
if (input.equals("u")) { |
|
|
|
decision = true; |
|
|
|
} |
|
|
|
println("Type new:"); |
|
|
|
newString = scan.nextLine(); |
|
|
|
editCredential(newID, newString, decision); |
|
|
|
editCredential(); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|