Class CmsLoginController


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

    • Method Detail

      • getFormLink

        public static java.lang.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 java.lang.String getLoginTarget​(CmsObject currentCms,
                                                      CmsWorkplaceSettings settings,
                                                      java.lang.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 java.io.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:
        java.io.IOException - if writing to the response fails
      • getPcType

        public java.lang.String getPcType()
        Gets the PC type.

        Returns:
        the PC type
      • getResetPasswordLink

        public java.lang.String 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

        protected java.lang.String getPasswordChangeMessage()
        Returns the message to be displayed for the user data check dialog.

        Returns:
        the message to display
      • handleError

        protected void handleError​(CmsObject currentCms,
                                   java.lang.String user,
                                   java.lang.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