/** * Handles the login. * <p> * In deferred mode, this method is called after the dummy POST request that * triggers the password manager has been completed. In direct mode (the * default setting), it is called directly when the user hits the enter key * or clicks on the login button. In the latter case, you cannot change the * URL in the method or the password manager will not be triggered. */ private void login() { Map<String, String> params = new HashMap<>(); params.put("username", getUsernameField().getValue()); params.put("password", getPasswordField().getValue()); LoginEvent event = new LoginEvent(LoginForm.this, params); fireEvent(event); }
private void init() { if (initialized) { return; } LoginFormState state = getState(); state.userNameFieldConnector = createUsernameField(); state.passwordFieldConnector = createPasswordField(); state.loginButtonConnector = createLoginButton(); StreamResource resource = new StreamResource(new LoginStreamSource(), LoginFormConstants.LOGIN_RESOURCE_NAME); resource.setMIMEType(ApplicationConstants.CONTENT_TYPE_TEXT_HTML_UTF_8); resource.setCacheTime(-1); setResource(LoginFormConstants.LOGIN_RESOURCE_NAME, resource); registerRpc((LoginFormRpc) this::login); initialized = true; setContent(createContent(getUsernameField(), getPasswordField(), getLoginButton())); }