Package com.mamaeye.exception

Examples of com.mamaeye.exception.UserException


  }

  @Override
  public User register(User user) throws UserException {
    if (StringUtils.isBlank(user.getNickname())) {
      throw new UserException("�dzƲ���Ϊ��");
    }
    if (StringUtils.isBlank(user.getEmail())) {
      throw new UserException("���䲻��Ϊ��");
    }
    if (StringUtils.isBlank(user.getPassword())) {
      throw new UserException("���벻��Ϊ��");
    }

    if (!StringUtils.equals(user.getPassword(), user.getCheckPassword())) {
      throw new UserException("�����������벻һ��");
    }

    if (existUser(user)) {
      throw new UserException("�����Ѵ���");
    }

    user.setStatus(1);
    String securityPassword = SecurityUtils
        .sha1(Constants.PASSWORD_PUBLIC_KEY + "-" + user.getPassword());
View Full Code Here


  @Override
  public User loginByForm(HttpServletRequest request,
      HttpServletResponse response, User user) throws UserException {

    if (StringUtils.isBlank(user.getNicknameOrEmail())) {
      throw new UserException("�û��������䲻��Ϊ��");
    }
    if (StringUtils.isBlank(user.getPassword())) {
      throw new UserException("�û��������벻��Ϊ��");
    }

    String securityPassword = SecurityUtils
        .sha1(Constants.PASSWORD_PUBLIC_KEY + "-" + user.getPassword());
    logger.debug("user.getNicknameOrEmail():[" + user.getNicknameOrEmail()
        + "] user.getNickname():[" + user.getNickname()
        + "] user.getEmail():[" + user.getEmail()
        + "] securityPassword:[" + securityPassword
        + "] securityPassword.length():[" + securityPassword.length()
        + "]");
    if (StringUtils.isNotBlank(user.getNickname())) {
      user = userDao.findUniqueByParams(new String[] { "status",
          "nickname", "password" }, new Object[] { 1,
          user.getNickname(), securityPassword });
    } else {
      user = userDao.findUniqueByParams(new String[] { "status", "email",
          "password" }, new Object[] { 1, user.getEmail(),
          securityPassword });
    }

    if (user == null) {
      throw new UserException("�û�������");
    }

    CookieManager.setCookie(Constants.COOKIE_UID, user.getId().toString(),
        -1, "/", "mamaeye.com", false, request, response);
    CookieManager.setCookie(Constants.COOKIE_NICKNAME, user.getNickname(),
View Full Code Here

TOP

Related Classes of com.mamaeye.exception.UserException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.