// ========================================================================== private boolean validateLogin() { boolean flag = false; String user = null; String password = null; try { user = jxlp.getUserName(); password = new String(jxlp.getPassword()); if (user == null || user.length() < 1) { jxlp.setMessage("user name is empty"); return false; } if (password == null || password.length() < 1) { jxlp.setMessage("password is empty"); return false; } flag = new ControllerAuthentication().login(user, password); if (!flag) { jxlp.setMessage("user or password are incorrect"); return false; } } catch (Exception e) { notifications.error("error while autenticate the user", e); } createUser(user); return flag; } // end validateLogin
// ========================================================================== private boolean checkPassword() { boolean flag = true; try { char password[] = jxlp.getPassword(); for (int i = 0; i < password.length; i++) { char c = password[i]; // Si no es letra o numero entonces no es valido if (!Character.isLetterOrDigit(c)) { flag = false; break; } } } catch (Exception e) { notifications.error("An error has occurred in the application", e); } return flag; } // end checkPassword