Search in sources :

Example 1 with LoginForm

use of com.vaadin.flow.component.login.LoginForm in project iesi by metadew.

the class LoginScreen method buildUI.

private void buildUI() {
    setSizeFull();
    setClassName("login-screen");
    // login form, centered in the available part of the screen
    LoginForm loginForm = new LoginForm();
    loginForm.addLoginListener(this::login);
    loginForm.addForgotPasswordListener(event -> Notification.show("Contact your framework administrator"));
    // layout to center login form when there is sufficient screen space
    FlexLayout centeringLayout = new FlexLayout();
    centeringLayout.setSizeFull();
    centeringLayout.setJustifyContentMode(JustifyContentMode.CENTER);
    centeringLayout.setAlignItems(Alignment.CENTER);
    centeringLayout.add(loginForm);
    // information text about logging in
    Component loginInformation = buildLoginInformation();
    add(loginInformation);
    add(centeringLayout);
}
Also used : FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) LoginForm(com.vaadin.flow.component.login.LoginForm) Component(com.vaadin.flow.component.Component)

Example 2 with LoginForm

use of com.vaadin.flow.component.login.LoginForm in project bookstore-example by vaadin.

the class LoginScreen method buildUI.

private void buildUI() {
    setSizeFull();
    setClassName("login-screen");
    // login form, centered in the available part of the screen
    LoginForm loginForm = new LoginForm();
    loginForm.addLoginListener(this::login);
    loginForm.addForgotPasswordListener(event -> Notification.show("Hint: same as username"));
    // layout to center login form when there is sufficient screen space
    FlexLayout centeringLayout = new FlexLayout();
    centeringLayout.setSizeFull();
    centeringLayout.setJustifyContentMode(JustifyContentMode.CENTER);
    centeringLayout.setAlignItems(Alignment.CENTER);
    centeringLayout.add(loginForm);
    // information text about logging in
    Component loginInformation = buildLoginInformation();
    add(loginInformation);
    add(centeringLayout);
}
Also used : FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) LoginForm(com.vaadin.flow.component.login.LoginForm) Component(com.vaadin.flow.component.Component)

Aggregations

Component (com.vaadin.flow.component.Component)2 LoginForm (com.vaadin.flow.component.login.LoginForm)2 FlexLayout (com.vaadin.flow.component.orderedlayout.FlexLayout)2