Index: trunk/src/org/expeditee/auth/Actions.java
===================================================================
--- trunk/src/org/expeditee/auth/Actions.java	(revision 1348)
+++ trunk/src/org/expeditee/auth/Actions.java	(revision 1357)
@@ -22,4 +22,5 @@
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -38,4 +39,5 @@
 import org.expeditee.auth.account.Authenticate.AuthenticationResult;
 import org.expeditee.auth.account.Create;
+import org.expeditee.auth.account.Create.CreateResult;
 import org.expeditee.auth.account.Password;
 import org.expeditee.auth.gui.MailBay;
@@ -49,4 +51,5 @@
 import org.expeditee.items.Text;
 import org.expeditee.settings.UserSettings;
+import org.expeditee.settings.identity.passwordrecovery.Colleagues;
 import org.expeditee.settings.identity.secrets.KeyList;
 import org.expeditee.stats.Formatter;
@@ -78,4 +81,10 @@
 		Mail.sendMail(mail, recipient);
 		MessageBay.displayMessage("Test message sent.");
+	}
+	public static void SetPWColleagues(String colleagueOne, String colleagueTwo) {
+		Colleagues.Colleague_One.set(colleagueOne);
+		Colleagues.Colleague_Two.set(colleagueTwo);
+		Colleagues.Colleague_One_Email.set("bnemhauser@gmail.com");
+		Colleagues.Colleague_Two_Email.set("bnemhauser@gmail.com");
 	}
 	
@@ -181,7 +190,11 @@
 			}
 			
-			Create.createAccount(userData);
-			Authenticate.login(userData);
-			AuthenticatorBrowser.Authenticated = true;
+			CreateResult result = Create.createAccount(userData);
+			if (result == CreateResult.SuccessCreateAccount) {
+				Authenticate.login(userData);
+				AuthenticatorBrowser.Authenticated = true;
+			} else {
+				MessageBay.errorMessage(result.toString());
+			}
 		} else {
 			MessageBay.errorMessage("Please fill out all the supplied text boxes.");
@@ -196,15 +209,14 @@
 	 */
 	public static void AuthLogin() {
-		final Collection<Text> textItems = DisplayController.getCurrentFrame().getTextItems();
-		final Optional<Map<AuthenticationTag, String>> userdata = AuthenticationTag.fetchUserData(textItems, false, AuthenticationTag.Username, AuthenticationTag.Password);
+		Collection<Text> textItems = DisplayController.getCurrentFrame().getTextItems();
+		Optional<Map<AuthenticationTag, String>> userdata = AuthenticationTag.fetchUserData(textItems, false, AuthenticationTag.Username, AuthenticationTag.Password);
 		if (userdata.isPresent()) {
 			AuthenticationResult result = Authenticate.login(userdata.get());
 			if (result == AuthenticationResult.SuccessLogin) {
 				MessageBay.displayMessage(result.toString());
+				AuthenticatorBrowser.Authenticated = true;
 			} else {
 				MessageBay.errorMessage(result.toString());
 			}
-			//login(userdata.get());
-			AuthenticatorBrowser.Authenticated = true;
 		} else {
 			MessageBay.errorMessage("Please fill out all the supplied text boxes.");
@@ -258,7 +270,8 @@
 	}
 	
-	public static void AuthResetPasswordPt1() {
+	public static void AuthDistributeIntergalacticNumber() {
 		Collection<Text> textItems = DisplayController.getCurrentFrame().getTextItems();
-		Optional<Map<AuthenticationTag, String>> userdata = AuthenticationTag.fetchUserData(textItems, false, AuthenticationTag.Username);
+		Optional<Map<AuthenticationTag, String>> userdata = 
+				AuthenticationTag.fetchUserData(textItems, false, AuthenticationTag.Username);
 		if (userdata.isPresent()) {
 			Map<AuthenticationTag, String> userData = userdata.get();
@@ -267,23 +280,36 @@
 			userData.put(AuthenticationTag.Email, email);
 			Password.generateAndDeliverIntergalacticNumber(userData);
-			MessageBay.displayMessage("A Intergalactic number has been sent to the email associated with your account.  Enter it below to proceed.");
-		}
-	}
-	
-	public static void AuthResetPasswordPt2() {
+			MessageBay.displayMessage("A identity number has been sent to the email "
+					+ "associated with your account.  Enter it below to proceed.");
+		}
+	}
+	
+	public static void AuthSubmitIntergalacticNumber() {
 		Collection<Text> textItems = DisplayController.getCurrentFrame().getTextItems();
-		Optional<Map<AuthenticationTag, String>> userdata = AuthenticationTag.fetchUserData(textItems, false, AuthenticationTag.Username, 
-				AuthenticationTag.IntergalacticNumber, AuthenticationTag.NewPassword, AuthenticationTag.NewPasswordAgain);
+		Optional<Map<AuthenticationTag, String>> userdata = 
+				AuthenticationTag.fetchUserData(textItems, false, AuthenticationTag.Username, 
+						AuthenticationTag.IntergalacticNumber);
 		if (userdata.isPresent()) {
-			Map<AuthenticationTag, String> userData = userdata.get();
-			String username = userData.get(AuthenticationTag.Username);
-			String email = getEmailFromUsername(username);
-			userData.put(AuthenticationTag.Email, email);
-			Password.confirmIntergalacticNumberAndGenerateSubstituteAccount(userData);
+			Map<AuthenticationTag, String> tags = userdata.get();
+			String username = tags.get(AuthenticationTag.Username);
+			String intergalacticNumber = tags.get(AuthenticationTag.IntergalacticNumber);
+			boolean match = false;
+			try {
+				match = AuthenticatorBrowser.getInstance().confirmIntergalaticNumber(username, intergalacticNumber);
+			} catch (NoSuchAlgorithmException | KeyStoreException | CertificateException | ClassNotFoundException
+					| IOException | SQLException e) {
+				e.printStackTrace();
+				return;
+			}
+			if (!match) {
+				MessageBay.errorMessage("The provided identity number does not match the one stored on file.");
+				return;
+			}
+			String[] colleagues = getPasswordColleaguesFromUsername(username);
+			Password.confirmIntergalacticNumberAndAlertColleagues(userdata.get(), colleagues);
 		}
 	}
 	
 	private static String getEmailFromUsername(String username) {
-		Collection<Text> textItems = DisplayController.getCurrentFrame().getTextItems();
 		Path credentialsDirPath = Paths.get(FrameIO.PROFILE_PATH).resolve(username).resolve(username + "-credentials");
 		Path credentialsFilePath = credentialsDirPath.resolve("credentials.inf");
@@ -303,5 +329,5 @@
 		int number = Integer.parseInt(fileName.replace(".exp", ""));
 		Frame credentialsFrame = FrameIO.LoadFrame(username + number, FrameIO.PROFILE_PATH);
-		textItems = credentialsFrame.getTextItems();
+		Collection<Text> textItems = credentialsFrame.getTextItems();
 		textItems.removeIf(text -> !text.getText().startsWith("Email: "));
 		if (textItems.isEmpty()) {
@@ -313,4 +339,42 @@
 			return email;
 		}
+	}
+	
+	private static String[] getPasswordColleaguesFromUsername(String username) {
+		Path credentialsDirPath = Paths.get(FrameIO.PROFILE_PATH).resolve(username).resolve(username + "-credentials");
+		Path credentialsFilePath = credentialsDirPath.resolve("pwcolleagues.inf");
+		String fileName = null;
+		if (credentialsFilePath.toFile().exists()) {
+			try (Scanner in = new Scanner(credentialsFilePath)) {
+				fileName = in.nextLine();
+			} catch (IOException e) {
+				MessageBay.errorMessage("Unable to password colleague frame for specified user, are they registered on this computer?");
+				return null;
+			}
+		} else {
+			MessageBay.errorMessage("Unable to password colleague frame for specified user, are they registered on this computer?");
+			return null;
+		}
+		
+		int number = Integer.parseInt(fileName.replace(".exp", ""));
+		Frame pwColleagueFrame = FrameIO.LoadFrame(username + number, FrameIO.PROFILE_PATH);
+		Collection<Text> textItems = pwColleagueFrame.getTextItems();
+		textItems.removeIf(text -> !text.getText().startsWith("Colleague"));
+		
+		String[] ret = new String[4];
+		Iterator<Text> it = textItems.iterator();
+		while(it.hasNext()) {
+			String content = it.next().getText().toLowerCase().trim();
+			if (content.contains("colleague_one:")) {
+				ret[0] = content.replace("colleague_one:", "").trim();
+			} else if (content.contains("colleague_two:")) {
+				ret[1] = content.replace("colleague_two:", "").trim();
+			} else if (content.contains("colleague_one_email:")) {
+				ret[2] = content.replace("colleague_one_email:", "").trim();
+			} else if (content.contains("colleague_two_email:")) {
+				ret[3] = content.replace("colleague_two_email:", "").trim();
+			}
+		}
+		return ret;
 	}
 	
