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