code: public String loginUser(String username, String password, String remoteAddress) throws CmsException {
  
          // login the user
          CmsUser newUser = m_securityManager.loginUser(m_context, username, password, remoteAddress);
          // set the project back to the "Online" project
          CmsProject newProject = m_securityManager.readProject(CmsProject.ONLINE_PROJECT_ID);
          // switch the cms context to the new user and project
          m_context.switchUser(newUser, newProject, newUser.getOuFqn());
          // init this CmsObject with the new user
          init(m_securityManager, m_context);
          // fire a login event
          fireEvent(I_CmsEventListener.EVENT_LOGIN_USER, newUser);
          // return the users login name
          return newUser.getName();
      }
docs: Logs a user with a given ip address into the Cms, if the password is correct.<p>
  
  @param username the name of the user
  @param password the password of the user
  @param remoteAddress the ip address
  
  @return the name of the logged in user
  
  @throws CmsException if the login was not successful