docs: public void login(String userName, String password, String projectName) {
  
          HttpSession session = null;
          m_loginException = null;
          try {
  
              // login the user and create a new session
              CmsUser user = getCmsObject().readUser(userName);
              OpenCms.getSessionManager().checkCreateSessionForUser(user);
              getCmsObject().loginUser(userName, password, getRequestContext().getRemoteAddress());
  
              // make sure we have a new session after login for security reasons
              session = getRequest().getSession(false);
              if (session != null) {
                  session.invalidate();
              }
              session = getRequest().getSession(true);
              if (projectName != null) {
                  // if this fails, the login is regarded as a failure as well
                  getCmsObject().getRequestContext().setCurrentProject(getCmsObject().readProject(projectName));
              }
              if (!getCmsObject().getRequestContext().getCurrentProject().isOnlineProject()) {
                  // in case the user is logged into an offline project, send any available login message
                  CmsLoginMessage loginMessage = OpenCms.getLoginManager().getLoginMessage();
                  if ((loginMessage != null) && loginMessage.isActive()) {
                      OpenCms.getSessionManager().updateSessionInfo(getCmsObject(), getRequest());
                      OpenCms.getSessionManager().sendBroadcast(null, loginMessage.getMessage(), user);
                  }
              }
  
          } catch (CmsException e) {
              // the login has failed
              m_loginException = e;
          }
          if (m_loginException == null) {
              // login was successful
              if (LOG.isInfoEnabled()) {
                  LOG.info(
                      Messages.get().getBundle().key(
                          Messages.LOG_LOGIN_SUCCESSFUL_3,
                          userName,
                          getRequestContext().addSiteRoot(getRequestContext().getUri()),
                          getRequestContext().getRemoteAddress()));
              }
          } else {
              // login was not successful
              if (session != null) {
                  session.invalidate();
              }
              CmsException currentLoginException = m_loginException;
              logLoginException(getRequestContext(), userName, currentLoginException);
          }
      }