Class CmsLoginController

java.lang.Object
org.opencms.ui.login.CmsLoginController

public class CmsLoginController extends Object
Controller class which actually handles the login dialog logic.

  • Field Details

  • Constructor Details

  • Method Details

    • getFormLink

      public static String getFormLink(CmsObject cms)
      Returns the link to the login form.

      Parameters:
      cms - the current cms context
      Returns:
      the login form link
    • getLoginTarget

      public static String getLoginTarget(CmsObject currentCms, CmsWorkplaceSettings settings, String requestedResource) throws CmsException
      Gets the login target link.

      Parameters:
      currentCms - the current CMS context
      settings - the workplace settings
      requestedResource - the requested resource parameter
      Returns:
      the login target
      Throws:
      CmsException - in case the user has insufficient permissions to access the login target
    • logout

      public static void logout()
      Logs the current user out by invalidating the session an reloading the current URI.

      Important: This works only within vaadin apps.

    • logout

      public static void logout(CmsObject cms, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
      Logs out the current user redirecting to the login form afterwards.

      Parameters:
      cms - the cms context
      request - the servlet request
      response - the servlet response
      Throws:
      IOException - if writing to the response fails
    • getPcType

      public String getPcType()
      Gets the PC type.

      Returns:
      the PC type
    • getResetPasswordLink

      Returns the reset password link.

      Returns:
      the reset password link
    • isShowSecure

      public boolean isShowSecure()
      Returns true if the security option should be displayed in the login dialog.

      Returns:
      true if the security option should be displayed in the login dialog
    • onClickForgotPassword

      public void onClickForgotPassword()
      Called when the user clicks on the 'forgot password' button.

    • onClickLogin

      public void onClickLogin()
      Called when the user clicks on the login button.

    • onInit

      public void onInit()
      Called on initialization.

    • setUi

      public void setUi(CmsLoginUI ui)
      Sets the login ui reference.

      Parameters:
      ui - the login ui
    • getPasswordChangeMessage

      Returns the message to be displayed for the user data check dialog.

      Returns:
      the message to display
    • handleError

      protected void handleError(CmsObject currentCms, String user, Exception e)
      Handles exceptions during the login process and displays appropriate error messages.
      Parameters:
      currentCms - the CMS context
      user - the user being logged in
      e - the error
    • initSessionAndSendMessages

      protected void initSessionAndSendMessages(CmsObject currentCms, CmsObject loginCms)
      Switches the session to a new one with the logged in CmsObject.

      This needs to be called in the last request to the Vaadin servlet in the login process, because switching the session breaks the Vaadin session state.

      Parameters:
      currentCms - the CmsObject for the current request from the Vaadin UI
      loginCms - the CmsObject which was used for the actual login operation