Package com.freewebsys.blog.pojo

Examples of com.freewebsys.blog.pojo.UserInfo


      // 比较特殊需要知道ID.
      boolean updateUrl = false;

      if (post.getId() == null) {
        // 获得session.
        UserInfo userInfo = (UserInfo) request.getSession()
            .getAttribute(GlobalConf.USER_SESSION);
        // 设置作者.
        post.setAuthorId(userInfo.getId());
        // 设置创建时间.
        post.setCreateDate(new Date().getTime());
        // 设置修改时间.
        post.setModifiedDate(new Date().getTime());
        updateUrl = true;
View Full Code Here


   */
  @Transactional
  public void deleteUserInfoById(Long id) throws Exception {
    log.info("deleteUserInfoById:" + id);
    try {
      UserInfo userInfo = (UserInfo) baseDao.findById(UserInfo.class, id);
      baseDao.delete(userInfo);
    } catch (Exception e) {
      log.info("UserInfo删除异常");
      e.printStackTrace();
    }
View Full Code Here

   */
  public String updateUserInfoRememberMe(Long userId) {
    log.info("updateUserInfoRememberMe:" + userId);
    try {
      // 查询用户信息.
      UserInfo userInfo = (UserInfo) baseDao.findById(UserInfo.class,
          userId);

      if (userInfo != null) {
        String rememberMe = PasswdUtil.crypt(userInfo.getLoginName()
            + System.currentTimeMillis());
        userInfo.setRememberMe(rememberMe);
        // update .
        baseDao.save(userInfo);
        return rememberMe;
      } else {
        return "";
View Full Code Here

  public String addUserInfo(HttpServletRequest request,
      HttpServletResponse response,
      @RequestParam(value = "id", required = false) Long id,
      ModelMap model) throws Exception {
    if (id != null) {
      UserInfo userInfo = userInfoService.findUserInfoById(id);
      model.addAttribute("userInfoAttribute", userInfo);
    } else {
      model.addAttribute("userInfoAttribute", new UserInfo());
    }
    return "/admin/userInfo/userInfoForm";
  }
View Full Code Here

   */
  @Transactional
  public void deleteUserInfoById(Long id) throws Exception {
    log.info("deleteUserInfoById:" + id);
    try{
      UserInfo userInfo = (UserInfo) baseDao.findById(UserInfo.class, id);
      baseDao.delete(userInfo);
    } catch (Exception e) {
      log.info("UserInfo删除异常");
      e.printStackTrace();
    }
View Full Code Here

   * 用户登录页面
   */
  @RequestMapping(value = "/admin/userLogin", method = RequestMethod.GET)
  public String userLoginGet(HttpServletRequest request,
      HttpServletResponse response, ModelMap model) throws Exception {
    model.addAttribute("userInfoAttribute", new UserInfo());
    return "/admin/userInfo/userInfoLogin";
  }
View Full Code Here

  public String userLoginPost(
      HttpServletRequest request,
      @ModelAttribute("userInfoAttribute") UserInfo userInfo,
      @RequestParam(value = "rememberme", required = false) Boolean rememberme,
      HttpServletResponse response, ModelMap model) throws Exception {
    model.addAttribute("userInfoAttribute", new UserInfo());

    if (StringUtils.isEmpty(userInfo.getLoginName())
        || StringUtils.isEmpty(userInfo.getPasswd())) {// 如果用户名密码是空.
      model.addAttribute("errorMsg",
          "\u8bf7\u8f93\u5165\u7528\u6237\u540d\u5bc6\u7801.");
      return "/admin/userInfo/userInfoLogin";
    }
    UserInfo userInfoTemp = userInfoService.getUserInfoByLogin(
        userInfo.getLoginName(), userInfo.getPasswd());
    System.out.println(rememberme);
    if (userInfoTemp == null) {
      model.addAttribute("errorMsg",
          "\u7528\u6237\u540d\u5bc6\u7801\u9519\u8bef.");
      return "/admin/userInfo/userInfoLogin";
    } else {
      if (rememberme != null && rememberme.booleanValue()) {
        // 如果够选记住我.就设置cookie.
        String remembermeKey = userInfoService
            .updateUserInfoRememberMe(userInfoTemp.getId());
        Cookie cookie = new Cookie("rememberme", remembermeKey);
        cookie.setMaxAge(60 * 60 * 24 * 30);
        response.addCookie(cookie);
        cookie = new Cookie("loginName", userInfoTemp.getLoginName());
        cookie.setMaxAge(60 * 60 * 24 * 30);
        response.addCookie(cookie);
      }
      request.getSession()
          .setAttribute(GlobalConf.USER_SESSION, userInfo);
View Full Code Here

   * 登出
   */
  @RequestMapping(value = "/admin/userLogout")
  public String userLogout(HttpServletRequest request,
      HttpServletResponse response, ModelMap model) throws Exception {
    model.addAttribute("userInfoAttribute", new UserInfo());
    model.addAttribute("infoMsg", "\u60a8\u5df2\u767b\u51fa\u3002");
    return "/admin/userInfo/userInfoLogin";
  }
View Full Code Here

   * 管理后台首页
   */
  @RequestMapping(value = "/admin/userMain")
  public String userMain(HttpServletRequest request,
      HttpServletResponse response, ModelMap model) throws Exception {
    model.addAttribute("userInfoAttribute", new UserInfo());
    model.addAttribute("infoMsg", "\u60a8\u5df2\u767b\u51fa\u3002");
    return "/admin/userInfo/userInfoMain";
  }
View Full Code Here

  public String addUserInfo(HttpServletRequest request,
      HttpServletResponse response,
      @RequestParam(value = "id", required = false) Long id,
      ModelMap model) throws Exception {
    if (id != null) {
      UserInfo userInfo = userInfoService.findUserInfoById(id);
      model.addAttribute("userInfoAttribute", userInfo);
    } else {
      model.addAttribute("userInfoAttribute", new UserInfo());
    }
    return "/admin/userInfo/userInfoForm";
  }
View Full Code Here

TOP

Related Classes of com.freewebsys.blog.pojo.UserInfo

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.