Package org.opencms.ui.login
Class CmsLoginController
java.lang.Object
org.opencms.ui.login.CmsLoginController
Controller class which actually handles the login dialog logic.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Represents the login target information.static class
The login context.protected static class
Helper subclass of CmsLoginUserAgreement which can be used without a page context. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Additional info key to mark accounts as locked due to inactivity.protected CmsTwoFactorAuthenticationHandler
The two-factor authentication handler. -
Constructor Summary
ConstructorDescriptionCmsLoginController
(CmsObject adminCms, CmsLoginHelper.LoginParameters params) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
getFormLink
(CmsObject cms) Returns the link to the login form.static String
getLoginTarget
(CmsObject currentCms, CmsWorkplaceSettings settings, String requestedResource) Gets the login target link.protected String
Returns the message to be displayed for the user data check dialog.Gets the PC type.Returns the reset password link.protected void
handleError
(CmsObject currentCms, String user, Exception e) Handles exceptions during the login process and displays appropriate error messages.protected void
initSessionAndSendMessages
(CmsObject currentCms, CmsObject loginCms) Switches the session to a new one with the logged in CmsObject.boolean
Returns true if the security option should be displayed in the login dialog.static void
logout()
Logs the current user out by invalidating the session an reloading the current URI.static void
logout
(CmsObject cms, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Logs out the current user redirecting to the login form afterwards.void
Called when the user clicks on the 'forgot password' button.void
Called when the user clicks on the login button.void
onInit()
Called on initialization.void
setUi
(CmsLoginUI ui) Sets the login ui reference.
-
Field Details
-
KEY_ACCOUNT_LOCKED
Additional info key to mark accounts as locked due to inactivity.- See Also:
-
m_otpHandler
The two-factor authentication handler.
-
-
Constructor Details
-
CmsLoginController
Creates a new instance.- Parameters:
adminCms
- the admin cms contextparams
- the parameters for the UI
-
-
Method Details
-
getFormLink
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 contextsettings
- the workplace settingsrequestedResource
- the requested resource parameter- Returns:
- the login target
- Throws:
CmsException
- in case the user has insufficient permissions to access the login target
-
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 contextrequest
- the servlet requestresponse
- the servlet response- Throws:
IOException
- if writing to the response fails
-
getPcType
Gets the PC type.- Returns:
- the PC type
-
getResetPasswordLink
Returns the reset password link.- Returns:
- the reset password link
-
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
Called when the user clicks on the 'forgot password' button. -
onClickLogin
Called when the user clicks on the login button. -
onInit
Called on initialization. -
setUi
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
Handles exceptions during the login process and displays appropriate error messages.- Parameters:
currentCms
- the CMS contextuser
- the user being logged ine
- the error
-
initSessionAndSendMessages
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 UIloginCms
- the CmsObject which was used for the actual login operation
-