code: public void login(String userName, String password, String projectName, String redirectUri) throws IOException {
  
          login(userName, password, projectName);
          if (m_loginException == null) {
              if (redirectUri != null) {
                  getResponse().sendRedirect(
                      OpenCms.getLinkManager().substituteLink(getCmsObject(), redirectUri, null, true));
              } else {
                  getResponse().sendRedirect(getFormLink());
              }
          }
      }
docs: Logs a system user in to OpenCms.<p>
  
  Note that if a login project name is provided, this project must exist,
  otherwise the login is regarded as a failure even if the user data was correct.<p>
  
  @param userName the users name
  @param password the password
  @param projectName the project to switch to after login (if null project is not switched)
  @param redirectUri the URI to redirect to after login (if null the current URI is used)
  
  @throws IOException in case redirect after login was not successful