Ejemplo n.º 1
0
 public ActionForward execute(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   User user = LegacySpringUtils.getUserManager().getLoggedInUser();
   String suppliedOldPassword = BeanUtils.getProperty(form, "oldpassword");
   String actualOldPassword = user.getPassword();
   String hashedSuppliedOldPassword = LogonUtils.hashPassword(suppliedOldPassword);
   if (hashedSuppliedOldPassword.equals(actualOldPassword)) {
     user.setPassword(LogonUtils.hashPassword(BeanUtils.getProperty(form, "passwordPwd")));
     user.setFirstlogon(false);
     LegacySpringUtils.getUserManager().save(user);
     AddLog.addLog(
         user.getUsername(),
         AddLog.PASSWORD_CHANGE,
         user.getUsername(),
         "",
         UserUtils.retrieveUsersRealUnitcodeBestGuess(user.getUsername()),
         "");
     return mapping.findForward("success");
   } else {
     request.setAttribute("error", "incorrect current password");
     return mapping.findForward("input");
   }
 }
Ejemplo n.º 2
0
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    String screenName = request.getParameter("screenname");
    if (screenName == null || screenName.trim().length() == 0) {
      return mapping.findForward("input");
    }
    User user = LegacySpringUtils.getUserManager().getLoggedInUser();

    if (user != null) {
      user.setScreenname(screenName);
      LegacySpringUtils.getUserManager().save(user);
    }

    setJforumScreenname(user);

    return LogonUtils.logonChecks(mapping, request);
  }
Ejemplo n.º 3
0
  private void setJforumScreenname(User user) {
    SSOUtils ssoutils = new SSOUtils();

    if (!ssoutils.userExists(user.getUsername())) {
      net.jforum.entities.User jforumuser = new net.jforum.entities.User();

      jforumuser.setUsername(user.getUsername());
      jforumuser.setPassword("sso");
      String email = null == user.getEmail() ? "" : user.getEmail();
      jforumuser.setEmail(email);
      jforumuser.setFrom(user.getScreenname());
      jforumuser.setActive(1);

      UserDAO dao = DataAccessDriver.getInstance().newUserDAO();

      dao.addNew(jforumuser);

      net.jforum.entities.User addedjforumuser = dao.selectByName(user.getUsername());

      addedjforumuser.setFrom(user.getScreenname());

      dao.update(addedjforumuser);
    }
  }