Package com.skyline.user.model

Examples of com.skyline.user.model.User


  @RequestMapping("/checkoldpassword/{password}")
  @ResponseBody
  public Boolean checkOldPassword(@PathVariable String password) {
    try {
      User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
      return personalInfoService.checkPassword(user.getId(), password);
    } catch (Exception e) {
      LOGGER.warn("检查密码是否匹配失败",e);
      return false;

    }
View Full Code Here


  public static AccountInfoMapper getMapper() {
    return MAPPER;
  }

  public User mapRow(ResultSet rs, int rowNum) throws SQLException {
    User user = new User();
    try {
      user.setAuthority(rs.getInt(COLUMN_AUTHORITY));
    } catch (SQLException e) {
      user.setAuthority(null);
    }
    try {
      user.setSecurityEmail(rs.getString(COLUMN_SECURITY_EMAIL));
    } catch (SQLException e) {
      user.setSecurityEmail(null);
    }
    try {
      user.setSecurityAnswer(rs.getString(COLUMN_SECURITY_ANSWER));
    } catch (SQLException e) {
      user.setSecurityAnswer(null);
    }
    try {
      user.setSecurityQuestion(rs.getString(COLUMN_SECURITY_QUESTION));
    } catch (SQLException e) {
      user.setSecurityQuestion(null);
    }
    user.setEmail(rs.getString(COLUMN_EMAIL));
    user.setId(rs.getLong(COLUMN_ID));
    return user;
  }
View Full Code Here

  public static UserMapper getMapper() {
    return MAPPER;
  }

  public User mapRow(ResultSet rs, int rowNum) throws SQLException {
    User user = new User();
    user.setActivity(Activity.valueOf(rs.getString(COLUMN_ACTIVITY)));
    user.setAuthority(rs.getInt(COLUMN_AUTHORITY));
    user.setBirthday(rs.getDate(COLUMN_BIRTHDAY));
    user.setCity(rs.getString(COLUMN_CITY));
    user.setCountry(rs.getString(COLUMN_COUNTRY));
    user.setCreateTime(rs.getDate(COLUMN_CREATE_TIME));
    user.setSecurityEmail(rs.getString(COLUMN_SECURITY_EMAIL));
    user.setEmail(rs.getString(COLUMN_EMAIL));
    user.setGraduateSchool(rs.getString(COLUMN_GRADUATE_SCHOOL));
    user.setJob(rs.getString(COLUMN_JOB));
    user.setLastLoginIp(rs.getString(COLUMN_LAST_LOGIN_IP));
    user.setLastLoginTime(rs.getDate(COLUMN_LAST_LOGIN_TIME));
    user.setMobilephone(rs.getString(COLUMN_MOBILE_PHONE));
    user.setMsn(rs.getString(COLUMN_MSN));
    user.setName(rs.getString(COLUMN_NAME));
    user.setNickname(rs.getString(COLUMN_NICKNAME));
    // u.setPassword(rs.getString("password"));
    user.setPortrait(rs.getString(COLUMN_PORTRAIT));
    user.setProvince(rs.getString(COLUMN_PROVINCE));
    user.setQq(rs.getString(COLUMN_QQ));
    user.setSecurityAnswer(rs.getString(COLUMN_SECURITY_ANSWER));
    user.setSecurityQuestion(rs.getString(COLUMN_SECURITY_QUESTION));
    if (rs.getString(COLUMN_SEX) != null)
      user.setSex(Sex.valueOf(rs.getString(COLUMN_SEX)));
    user.setSiteId(rs.getString(COLUMN_SITE_ID));
    user.setUpdateTime(rs.getDate(COLUMN_UPDATE_TIME));
    user.setId(rs.getLong(COLUMN_ID));
    return user;
  }
View Full Code Here

  private String ext;

  public void regist(String email, String password, String ip) {
    password = encodePassword(password);
    basicUserDao.insertUser(email, password, ip);
    User user = basicUserDao.queryUserByEmail(email);
    albumDao.insertAlbumReturnId(user.getId(), user.getNickname(),
        user.getPortrait(), "default", "default", "default",
        Authority.PRIVATE, Activity.UNDELETABLE, cover, ext);
    categoryService.createDefaultCategory(user.getId(), user.getPortrait(),
        user.getNickname());
  }
View Full Code Here

  public User login(String email, String password, String loginIP) {

    // password =
    // String.valueOf(DigestUtils.md5DigestAsHex(password.getBytes()));
    password = encodePassword(password);
    User user = basicUserDao.queryUserByEmailAndPassword(email, password);
    if (user != null) {
      basicUserDao.updateLoginInfo(user.getId(), loginIP);
    }
    return user;
  }
View Full Code Here

  @Override
  public boolean modifyPassword(String email, String oldPassword, String newPassword) {
    oldPassword = encodePassword(oldPassword);
    newPassword = encodePassword(newPassword);
    User user = accountInfoDao.queryAccountInfoByEmailAndPswd(email, oldPassword);
    if (user == null) {
      return false;
    } else {
      accountInfoDao.updatePassword(user.getId(), newPassword);
      return true;
    }
  }
View Full Code Here

  }

  @Override
  public Boolean checkPassword(Long userId, String password) {
    password = String.valueOf(DigestUtils.md5Hex(password));
    User user = personalInfoDao.queryPersonInfoByIdAndPassword(userId, password);
    if (user == null)
      return false;
    return true;
  }
View Full Code Here

    // System.out.println(findType);
    FindPswdStat findPswdStat = (FindPswdStat) WebHelper.getSessionAttribute(null, Constant.SESSION_FIND_PSWD_STAT);
    if (findPswdStat != null || findPswdStat != FindPswdStat.FINISHED) {
      // 运行步骤出错了;
    }
    User user = accountInfoService.getAccountInfoByEmail(email);
    if (user == null) {
      // 用户不存在
      mav.setViewName(ViewPaths.USER_FINDPSWDREQUEST);
      mav.addObject("errorMessage", "你所输入的用户不存在。");
    } else {

      WebHelper.setSessionAttribute(null, Constant.SESSION_FIND_PSWD_USER, user);
      // 用户请求通过安全email来找回密码
      if (findType == 0) {
        String toSendEmail = null;
        if (user.getSecurityEmail() != null) {
          toSendEmail = user.getSecurityEmail();
          mav.addObject("message", "成功发送到您的安全E-mail(" + toSendEmail + ")。");
        } else {
          toSendEmail = email;
          mav.addObject("message", "成功发送到您的E-mail(" + toSendEmail + ")。");
        }
        mav.addObject("email", email);
        EmailToken token = emailTokenService.addToken(user.getId(), email, EmailTokenType.PASSWORD_FIND);
        String emailTitle = FreeMarkerUtils.getForgetPasswordMailTitle(email);
        String emailContent = FreeMarkerUtils.getForgetPasswordMailContent(email, token.getToken());
        // emailTitle,emailContent输出已经测试过了
        MailUtils.sendHtmlMail(toSendEmail, emailTitle, emailContent);
        WebHelper.setSessionAttribute(null, Constant.SESSION_FIND_PSWD_STAT, FindPswdStat.FINISHED);
        mav.setViewName(ViewPaths.USER_FINDPSWDBYEMAIL);
      }
      // 通过回答问题来找回密码
      else if (findType == 1) {
        String securityQuestion = user.getSecurityQuestion();
        if (securityQuestion != null) {
          mav.addObject("securityQuestion", securityQuestion);
          WebHelper.setSessionAttribute(null, Constant.SESSION_FIND_PSWD_STAT, FindPswdStat.REQUEST_TO_ANSWER_QUESTION);
          WebHelper.setSessionAttribute(null, Constant.SESSION_FIND_PSWD_QUESTION_ANSWERED, 0);
        } else {
View Full Code Here

   */
  @RequestMapping(value = "/listMyFeeds", method = RequestMethod.POST)
  @SuppressWarnings("unchecked")
  public @ResponseBody
  FeedResult getMyFeeds(HttpServletRequest request, Integer current, Integer level) {
    User user = (User) WebHelper.getSessionAttribute(request, Constant.SESSION_USER);
    List<Fan> fans = (List<Fan>) WebHelper.getSessionAttribute(request, Constant.SESSION_IDOLS);
    // 用户已经登陆
    if (user != null && user.getId() != 0 && fans != null) {
      List<Long > idolIds=new ArrayList<Long>();
      for(Fan fan : fans){
        idolIds.add(fan.getIdolId());
        //System.out.println(fan.getIdolId());
      }
      //long t1=System.currentTimeMillis();
      FeedResult result = subscribedFeedService.getFeeds(idolIds, user.getId(), current, level);
      if (current == 0 && level == 0) {
        WebHelper.setSessionAttribute(request, Constant.SESSION_LAST_QUERY_TIME, (new Date()).getTime());
      }
      //long t2=System.currentTimeMillis();
      //System.out.println(t2-t1);
View Full Code Here

   * @return
   */
  @RequestMapping(value = "/password/find/answerQuestion", method = RequestMethod.POST)
  public ModelAndView answerQuestion(String securityAnswer) {
    ModelAndView mav = new ModelAndView();
    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_FIND_PSWD_USER);
    FindPswdStat findPswdStat = (FindPswdStat) WebHelper.getSessionAttribute(null, Constant.SESSION_FIND_PSWD_STAT);
    Integer tryAnswerTime = (Integer) WebHelper.getSessionAttribute(null, Constant.SESSION_FIND_PSWD_QUESTION_ANSWERED);
    if (user == null || findPswdStat == null || findPswdStat != FindPswdStat.REQUEST_TO_ANSWER_QUESTION || tryAnswerTime == null
        || tryAnswerTime >= 2) {
      // 步骤出错了
      // mav.set
    } else {
      tryAnswerTime++;
      WebHelper.setSessionAttribute(null, Constant.SESSION_FIND_PSWD_QUESTION_ANSWERED, tryAnswerTime);
      String securityQuestion = user.getSecurityQuestion();
      mav.addObject("securityQuestion", securityQuestion);
      if (user.getSecurityAnswer().equals(securityAnswer)) {
        WebHelper.setSessionAttribute(null, Constant.SESSION_FIND_PSWD_STAT, FindPswdStat.ANSWERED_QUESTION);
        mav.setViewName(ViewPaths.USER_RESETPASSWORD);
      } else {
        mav.setViewName(ViewPaths.USER_FINDPSWDBYANSWER);
      }
View Full Code Here

TOP

Related Classes of com.skyline.user.model.User

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.