public User getUserByUsername(String u, String psd) throws UserNotFoundException { /*if(true){ User user = new User(); user.setUsername(u); user.setPassword("123"); return user; }*/ /*if(F.empty(psd)){ ClientSession session = SessionManager.getInstance().getSession(u); if(session!=null&&session.getSessionData("userinfo")!=null){ User user = (User)session.getSessionData("userinfo"); return user; } }*/ boolean lg = false; try { lg = JbApi.login(u, psd); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } User user = new User(); user.setUsername(u); if (lg) { user.setPassword(psd); } else { user.setPassword(""); } return user; }
public User getUserByUsernameHttp(String u, String psd) throws UserNotFoundException { boolean lg = false; try { lg = JbApi.login(u, psd); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } User user = new User(); user.setUsername(u); if (lg) { user.setPassword(psd); } else { user.setPassword(""); } return user; }