/*     */   public String attemptingToConnectNewAccount(String username, char[] password, char[] passwordConfirm)
/*     */   {
/* 160 */     if (username.length() < 3)
/*     */     {
/* 162 */       return "Your username must contain at least 3 characters.";
/*     */     }
/*     */ 
/* 165 */     if (password.length < 6)
/*     */     {
/* 167 */       return "Password is too short, minimum 6 characters.";
/*     */     }
/*     */ 
/* 170 */     if (!verifyPassword(password, passwordConfirm))
/*     */     {
/* 173 */       System.out.println("Wrong password");
/* 174 */       return "Passwords do not match";
/*     */     }
/*     */ 
/* 178 */     Pattern p = Pattern.compile("^[0-9a-zA-Z\\s]*$");
/* 179 */     boolean hasSpecialChar = p.matcher(username).find();
/*     */ 
/* 181 */     if (!hasSpecialChar) {
/* 182 */       return "Your username can only be letters , numbers, and spaces.";
/*     */     }
/* 184 */     String actualPassword = "";
/*     */ 
/* 186 */     for (int i = 0; i < password.length; i++)
/*     */     {
/* 188 */       actualPassword = actualPassword + password[i];
/*     */     }
/*     */ 
/*     */     try
/*     */     {
/* 195 */       String rawStringToSend = "NEW=" + username + "," + actualPassword;
/*     */ 
/* 197 */       byte[] encryptedBytesToSend = PublicKeyManager.encrypt(rawStringToSend, Config.PUBLIC_KEY);
/* 198 */       int byteLength = encryptedBytesToSend.length;
/*     */ 
/* 202 */       this.socket = new Socket("38.89.137.25", 3336);
/* 203 */       DataOutputStream outputStream = new DataOutputStream(this.socket.getOutputStream());
/* 204 */       outputStream.writeInt(byteLength);
/* 205 */       outputStream.write(encryptedBytesToSend);
/* 206 */       outputStream.flush();
/*     */ 
/* 210 */       BufferedReader in = new BufferedReader(new InputStreamReader(this.socket.getInputStream()));
/*     */ 
/* 214 */       String serverResponse = in.readLine();
/* 215 */       System.out.println(serverResponse);
/*     */ 
/* 217 */       if (serverResponse.equals("ERROR=Username already exsists!")) {
/* 218 */         return "This username has already been taken.";
/*     */       }
/* 220 */       if (serverResponse.equals("USERCREATED")) {
/* 221 */         attemptingToConnect(username, password);
/*     */       }
/*     */ 
/*     */     }
/*     */     catch (UnknownHostException e)
/*     */     {
/* 227 */       e.printStackTrace();
/*     */     } catch (IOException e) {
/* 229 */       e.printStackTrace();
/*     */     }
/*     */ 
/* 234 */     return "";
/*     */   }