Package com.finiac.model

Examples of com.finiac.model.User


  public boolean userLogin(HttpServletRequest request, String userName, String password)throws Exception
  {
    if(userName==null || password == null)
      throw new LoginException();
    String cryptPassword = DigestUtils.sha256Hex(password +passwordHashPadding);
    User user = new User();
    List<User> userList=userDAO.selectUser(userName,cryptPassword);
    if(userList.size()==0)
      throw new LoginException();
    for(int i=0;i<userList.size();i++)
    {
      user = userList.get(i);
    }
    request.getSession().setAttribute("userName", user.getUserName());
    request.getSession().setAttribute("userRole", user.getRole());
    return true;
  }
View Full Code Here


  public int userRegister(String userName, String password, String role) throws Exception
  {
    if(userName.length()<6||password.length()<6||role.length()==0)
      throw new UnableToRegisterException();
    String cryptPassword = DigestUtils.sha256Hex(password +passwordHashPadding);
    User user = new User();
    user.setUserName(userName);
    user.setPassword(cryptPassword);
    user.setRole(role);
    userDAO.addOrupdateUser(user);
    return 1;
  }
View Full Code Here

  }
  public ModelAndView addUserPage(HttpServletRequest request, HttpServletResponse response)throws Exception
  {
    ModelMap modelMap = new ModelMap();
    modelMap.addAttribute("userList", userDAO.listUser());
    modelMap.addAttribute("user", new User());
    return new ModelAndView("addUser",modelMap);
  }
View Full Code Here

    }
  }
  public ModelAndView updateUserPage(HttpServletRequest request, HttpServletResponse response)throws Exception
  {
    long id=Long.parseLong(request.getParameter("id"));
    User user = new User();
    user=userDAO.selectById(id);
    return new ModelAndView("updateUser", "user", user);
  }
View Full Code Here

      long userId=Long.parseLong(request.getParameter("userId"));
      String password=request.getParameter("password");
      String role=request.getParameter("role");
      if(password.length()<6||role.length()==0)
        throw new UnableToRegisterException();
      User user= new User();
      user= userDAO.selectById(userId);
      String cryptPassword = DigestUtils.sha256Hex(password +passwordHashPadding);
      user.setPassword(cryptPassword);
      user.setRole(role);
      userDAO.updateUser(user);
      return new ModelAndView("redirect:addUserPage.htm");
  }
      catch (UnableToRegisterException e) {
        long userId=Long.parseLong(request.getParameter("userId"));
View Full Code Here

   
        String currentPassword=request.getParameter("currentPassword");
        String newPassword1=request.getParameter("newPassword1");
        String newPassword2=request.getParameter("newPassword2");
        String userName=request.getSession().getAttribute("userName").toString();
        User user=userDAO.selectByUserName(userName);
        if(!newPassword1.equals(newPassword2))
          urlSuffix="passwordMismatch=true";
        else if(newPassword1.length()<6)
          urlSuffix+="passwordLength=false";
        changePassword(user,currentPassword,newPassword1,newPassword2);
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  public User selectById(long userId) {
    List<User> userList=hibernateTemplate.find("from User where id = "+userId);
    User user = new User();
    for(int i=0;i<userList.size();i++)
    {
      user = userList.get(i);
    }
    return user;
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  public User selectByUserName(String userName) {
    List<User> userList=hibernateTemplate.find("from User where userName = '"+userName+"'");
    User user = new User();
    for(int i=0;i<userList.size();i++)
    {
      user = userList.get(i);
    }
    return user;
View Full Code Here

TOP

Related Classes of com.finiac.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.