/** * 登录验证 * * @param account 帐号,可以是帐号、email、手机号 * @param password 密码 * @return resultVO */ public ResultVO login(String account, String password) { ResultVO resultVO = new ResultVO(); UserVO userVO = userDAO.queryUserByCodeOrEmailOrPhone(account); if (userVO == null) { resultVO = new ResultVO("账号或密码错误"); } else { if (!password.equals(userVO.getPassword())) { resultVO = new ResultVO("账号或密码错误"); } } EnvironmentInfoVO objEnvironmentInfoVO = new EnvironmentInfoVO(); objEnvironmentInfoVO.setUser(userVO); WebContext objWebContext = WebContextFactory.get(); objWebContext.getSession().setAttribute("environmentInfo", objEnvironmentInfoVO); if (resultVO.isSuccess()) { objWebContext.getSession().setAttribute("current_user", userVO); } return resultVO; }
/** * 查询用户,根据帐号或者email或者phone * * @param account * @return */ public UserVO getUser(String account) { return userDAO.queryUserByCodeOrEmailOrPhone(account); }