Skip to content

Commit

Permalink
Reverted back to console api
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas4g committed Sep 8, 2015
1 parent 0037a38 commit cd16468
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ lazy val root = (project in file(".")).
settings(
name := "git-submitter-plugin",
organization := "org.cs1331",
version := "0.2",
version := "0.3-SNAPSHOT",
sbtPlugin := true,
scalaVersion := "2.10.4",
publishMavenStyle := true,
Expand Down
18 changes: 3 additions & 15 deletions src/main/java/org/cs1331/gitsubmitter/AuthenticatedUser.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,6 @@ public static AuthenticatedUser create()
boolean twoFactor = false;
String twoFactorCode = null;
Scanner keyboard = new Scanner(System.in);
Thread maskPassword = new Thread(() -> {
while (true) {
System.out.print("\010\040");
try {
Thread.currentThread().sleep(1);
} catch(InterruptedException ie) {
ie.printStackTrace();
}
}
});

do {
if (base64Auth.length() > 0) {
Expand All @@ -53,12 +43,10 @@ public static AuthenticatedUser create()

System.out.print("\tUsername: ");
System.out.flush();
user = keyboard.nextLine();
user = System.console().readLine();
System.out.print("\tPassword: ");
System.out.flush();
maskPassword.start();
password = keyboard.nextLine();
maskPassword.stop();
password = new String(System.console().readPassword());

base64Auth = Base64.getEncoder().encodeToString((user + ":" + password)
.getBytes());
Expand All @@ -74,7 +62,7 @@ public static AuthenticatedUser create()

if (twoFactor) {
System.out.println("\tTwo-Factor Code:");
twoFactorCode = keyboard.nextLine();
twoFactorCode = System.console().readLine();
success = Utils.testTwoFactorAuth(base64Auth, twoFactorCode);
}
} while (!success);
Expand Down

0 comments on commit cd16468

Please sign in to comment.