public abstract class AbstractLogin extends Component implements HasEnabled
<vaadin-login-overlay> and
<vaadin-login-form> components. On LoginForm.LoginEvent
component becomes disabled. Disabled component stops to process login events,
however the LoginForm.ForgotPasswordEvent event is processed anyway.
To enable use the
HasEnabled.setEnabled(boolean) method.
Setting error setError(boolean) true makes component automatically
enabled for the next login attempt.| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractLogin.ForgotPasswordEvent
`forgot-password` is fired when the user clicks Forgot password button
|
static class |
AbstractLogin.LoginEvent
`login` is fired when the user either clicks Submit button or presses an
Enter key.
|
| Constructor and Description |
|---|
AbstractLogin()
Initializes a new AbstractLogin with a default localization.
|
AbstractLogin(LoginI18n i18n)
Initializes a new AbstractLogin.
|
| Modifier and Type | Method and Description |
|---|---|
Registration |
addForgotPasswordListener(ComponentEventListener<AbstractLogin.ForgotPasswordEvent> listener)
Adds `forgotPassword` event listener.
|
Registration |
addLoginListener(ComponentEventListener<AbstractLogin.LoginEvent> listener)
Adds `login` event listener
|
String |
getAction()
Returns the action defined for a login form.
|
boolean |
isError()
Returns whether the error message is displayed or not
|
boolean |
isForgotPasswordButtonVisible()
Returns whether the forgot password button is visible or not
|
void |
onEnabledStateChanged(boolean enabled)
Handle component enable state when the enabled state changes.
|
void |
setAction(String action)
Sets the path where to send the form-data when a form is submitted.
|
void |
setError(boolean error)
Sets whether to show or hide the error message.
|
void |
setForgotPasswordButtonVisible(boolean forgotPasswordButtonVisible)
Sets whether to show or hide the forgot password button.
|
void |
setI18n(LoginI18n i18n)
Sets the internationalized messages to be used by this instance.
|
void |
setUnsafeAction(String action)
Sets the action URL without validating its scheme.
|
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, set, setElement, setId, setVisibleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisEnabled, setEnabledgetElementaddAttachListeneraddDetachListenerpublic AbstractLogin()
public AbstractLogin(LoginI18n i18n)
i18n - internationalized messages to be used by this instance.public void setAction(String action)
AbstractLogin.LoginEvent is not fired
anymore.IllegalArgumentException - if action uses a scheme that is not considered safe
according to
DeploymentConfiguration.getUrlSafeSchemes(); see
setUnsafeAction(String) and the
configuration
propertygetAction(),
setUnsafeAction(String)public void setUnsafeAction(String action)
Unlike setAction(String), this method does not reject URLs based
on the configuration. Use it
only for URLs that are fully under your control and known to be safe,
such as a hard-coded javascript: URL. Passing untrusted input
here can expose the application to cross-site scripting (XSS) attacks.
action - the action URLsetAction(String)@Synchronize(property="action", value="action-changed") public String getAction()
public void setError(boolean error)
setI18n(LoginI18n)
Calling this method with true will also enable the component.error - true to show the error message and enable component
for next login attempt, false to hide an errorisError()@Synchronize(property="error", value="error-changed") public boolean isError()
public void setForgotPasswordButtonVisible(boolean forgotPasswordButtonVisible)
forgotPasswordButtonVisible - whether to display or hide the buttonisForgotPasswordButtonVisible()public boolean isForgotPasswordButtonVisible()
true if the forgot password button is visible
false otherwisepublic void setI18n(LoginI18n i18n)
i18n - the internationalized messagesLoginI18n.createDefault()public Registration addLoginListener(ComponentEventListener<AbstractLogin.LoginEvent> listener)
public Registration addForgotPasswordListener(ComponentEventListener<AbstractLogin.ForgotPasswordEvent> listener)
HasEnabled.isEnabled().public void onEnabledStateChanged(boolean enabled)
ComponentBy default this sets or removes the 'disabled' attribute from the element. This can be overridden to have custom handling.
onEnabledStateChanged in class Componentenabled - the new enabled state of the componentCopyright © 2026. All rights reserved.