Пример #1
0
  public static Boolean Login(String userName, String password) {
    if (StringHelper.IsNullOrWhitespace(userName) || StringHelper.IsNullOrWhitespace(password))
      return false;

    userName = userName.toLowerCase();

    String passwordHash = DigestUtils.md5Hex(password);
    UserEntity user = UserEntityHelper.GetUserByUserName(userName);
    if (user == null) return false;

    if (!user.getPassword().equals(passwordHash)) return false;

    if (user.getIsEnabled() == false) return false;

    SessionManager.getInstance().createSession(user);

    return true;
  }
Пример #2
0
 public void checkCredentials(String user, String pwd) throws InvalidCustomerAccountException {
   if (!(sender.getUsername().equals(user) && sender.getPassword().equals(pwd))) {
     throw new InvalidCustomerAccountException("Error: Username or password not correct");
   }
 }