@Override public User checkLogin(String account, String password) { password = PasswordMD.md5(password); User u = userDao.queryByAccount(account); if (u == null) { u = userDao.queryByEnEmail(account); } if (u != null && password.equals(u.getPassword())) { return u; } else { throw new ServiceException(ErrService.UserS.ACC_109, "用户账号或者密码错误"); } }
@Override public void editUserEmail(Long userId, String email) { if (email == null || email.equals("")) { throw new ServiceException(ErrService.UserS.ACC_102, "电子邮箱格式错误。"); } User u = userDao.queryByEnEmail(email); if (u != null) { throw new ServiceException(ErrService.UserS.ACC_102, "该电子邮箱已经被激活。"); } User user = userDao.queryById(userId); if (!email.equals(user.getEmail())) { userDao.updateEmail(userId, email); } }