@Override public User login(String anyAccount, String password) throws ServiceException { QueryCondition qc = userDao.getQC(); qc.eq("mobile", anyAccount); User user = userDao.uniqueByQC(qc); if (null == user) { throw new ServiceException("用户不存在"); } if (!user.getPassword().equals(password)) { throw new ServiceException("密码错误"); } user = loginHandle(user); return user; }
@Override public void passwordReset(String mobile, String password, int captcha) { if (!checkCaptcha(mobile, captcha)) { throw new ServiceException("验证码错误!"); } QueryCondition qc = userDao.getQC(); qc.eq("mobile", mobile); User user = userDao.uniqueByQC(qc); if (null == user) { throw new ServiceException("用户不存在"); } user.setPassword(password); userDao.update(user); }