|
|
@ -21,10 +21,10 @@ public class Vault implements VaultInterface { |
|
|
|
OutputStream outputS = System.out; |
|
|
|
private CredentialRepository credentialRepository = new CredentialRepository(); |
|
|
|
|
|
|
|
public static void main (String args[]) { |
|
|
|
/*public static void main (String args[]) { |
|
|
|
Vault vault = new Vault(); |
|
|
|
vault.credentialMenu(); |
|
|
|
} |
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
private void println(String output) { |
|
|
@ -51,25 +51,36 @@ public class Vault implements VaultInterface { |
|
|
|
|
|
|
|
String input = scan.nextLine(); |
|
|
|
|
|
|
|
if (input.equals("e")) { |
|
|
|
switch(input) { |
|
|
|
case "e": |
|
|
|
config = false; |
|
|
|
} else if (input.equals("l")) { |
|
|
|
break; |
|
|
|
|
|
|
|
case "l": |
|
|
|
println("Set PW length:"); |
|
|
|
String inputPw = scan.nextLine(); |
|
|
|
setPWLength(inputPw); |
|
|
|
} else if (input.equals("h")) { |
|
|
|
break; |
|
|
|
|
|
|
|
case "h": |
|
|
|
println("Should your PW have capitals? Type in yes or no."); |
|
|
|
String inputC = scan.nextLine(); |
|
|
|
setCapital(inputC); |
|
|
|
} else if (input.equals("s")){ |
|
|
|
break; |
|
|
|
|
|
|
|
case "s": |
|
|
|
println("Should you PW have special characters? Type in yes or no."); |
|
|
|
String inputS = scan.nextLine(); |
|
|
|
setSpecialChar(inputS); |
|
|
|
} else if (input.equals("n")) { |
|
|
|
break; |
|
|
|
|
|
|
|
case "n": |
|
|
|
println("Should you PW have numbers? Type in yes or no."); |
|
|
|
String inputN = scan.nextLine(); |
|
|
|
setNumbers(inputN); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void setPWLength(String pwLength) { |
|
|
@ -157,40 +168,41 @@ public class Vault implements VaultInterface { |
|
|
|
|
|
|
|
String input = scan.nextLine(); |
|
|
|
|
|
|
|
|
|
|
|
if (input.equals("e")) { |
|
|
|
switch(input) { |
|
|
|
case "e": |
|
|
|
credentialM = false; |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
if (input.equals("a")) { |
|
|
|
case "a": |
|
|
|
println("Type in username"); |
|
|
|
userName = scan.nextLine(); |
|
|
|
|
|
|
|
println("Type in password"); |
|
|
|
password = scan.nextLine(); |
|
|
|
addCredential(userName, password); |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
if (input.equals("c")) { |
|
|
|
case "c": |
|
|
|
println("Type in ID or username"); |
|
|
|
|
|
|
|
String str = scan.nextLine(); |
|
|
|
showCredential(str); |
|
|
|
break; |
|
|
|
|
|
|
|
} else if (input.equals("l")) { |
|
|
|
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; |
|
|
|
}else{ |
|
|
|
if (!input.equals("u")) { |
|
|
|
decision = false; |
|
|
|
} |
|
|
|
println("Type new:"); |
|
|
|
newString = scan.nextLine(); |
|
|
|
//editCredential(newID, newString, decision); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |