code: public void setPassword(CmsDbContext dbc, String username, String newPassword)
      throws CmsException, CmsIllegalArgumentException {
  
          validatePassword(newPassword);
  
          // read the user as a system user to verify that the specified old password is correct
          CmsUser user = getUserDriver(dbc).readUser(dbc, username);
          // only continue if not found and read user from web might succeed
          getUserDriver(dbc).writePassword(dbc, username, null, newPassword);
          user.getAdditionalInfo().put(
              CmsUserSettings.ADDITIONAL_INFO_LAST_PASSWORD_CHANGE,
              "" + System.currentTimeMillis());
          getUserDriver(dbc).writeUser(dbc, user);
  
          // fire user modified event
          Map<String, Object> eventData = new HashMap<String, Object>();
          eventData.put(I_CmsEventListener.KEY_USER_ID, user.getId().toString());
          eventData.put(I_CmsEventListener.KEY_USER_ACTION, I_CmsEventListener.VALUE_USER_MODIFIED_ACTION_RESET_PASSWORD);
          eventData.put(
              I_CmsEventListener.KEY_USER_CHANGES,
              Integer.valueOf(CmsUser.FLAG_CORE_DATA | CmsUser.FLAG_CORE_DATA));
          OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_USER_MODIFIED, eventData));
      }
docs: Sets the password for a user.<p>
  
  @param dbc the current database context
  @param username the name of the user
  @param newPassword the new password
  
  @throws CmsException if operation was not successful
  @throws CmsIllegalArgumentException if the user with the <code>username</code> was not found