- Timestamp:
- 03/22/19 16:13:57 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/auth/Authenticator.java
r1266 r1267 82 82 } 83 83 84 private Authenticator() throws KeyStoreException, FileNotFoundException, IOException, NoSuchAlgorithmException, CertificateException, ClassNotFoundException, SQLException { 84 private Authenticator() throws KeyStoreException, FileNotFoundException, IOException, NoSuchAlgorithmException, CertificateException, ClassNotFoundException, SQLException { 85 System.out.println("Running Expeditee in Authentication Mode."); 85 86 UserSettings.setupDefaultFolders(); 86 87 … … 133 134 // Fetch desired password 134 135 Scanner in = new Scanner(System.in); 135 System.out.println("You have definately not yet set up a password for the administration account on Expeditee."); 136 System.out.print("Please enter it now: "); 137 System.out.flush(); 138 String password = in.nextLine(); 139 System.out.print("And again: "); 140 System.out.flush(); 141 if (in.nextLine().equals(password)) { 142 // Register account. 143 putKey(ADMINACCOUNT, password, new SecretKeySpec("null".getBytes(), AsymmetricAlgorithm)); 144 in.close(); 145 } else { 146 in.close(); 147 System.out.println("Mismatched passwords, lets try that again."); 148 protectAdmin(); 136 System.out.println("No administrative password set."); 137 boolean passwordIsSet = false; 138 139 for (int i = 0; i < 3; i++) { 140 System.out.print("Please enter it now: "); 141 System.out.flush(); 142 String password = in.nextLine(); 143 System.out.print("And again: "); 144 System.out.flush(); 145 if (in.nextLine().equals(password)) { 146 // Register account. 147 putKey(ADMINACCOUNT, password, new SecretKeySpec("null".getBytes(), AsymmetricAlgorithm)); 148 in.close(); 149 passwordIsSet = true; 150 break; 151 } else { 152 System.out.println("Mismatched passwords, let's try that again."); 153 } 154 } 155 156 if (!passwordIsSet) { 157 System.out.println("Failed to set an admin password. Exiting Expeditee."); 158 System.exit(1); 149 159 } 150 160 }
Note:
See TracChangeset
for help on using the changeset viewer.