Example #1
0
  /**
   * ************************************* Performs the login with the data from the input fields.
   */
  protected void login() {
    aLoginButton.setEnabled(false);

    String sUserName = bReauthenticate ? Cookies.getCookie(sUserCookie) : aUserField.getText();

    String sPassword = aPasswordField.getText();

    setUserNameCookie(sUserName);

    ServiceRegistry.getCommandService()
        .executeCommand(
            AuthenticatedService.LOGIN,
            createLoginData(sUserName, sPassword),
            new AsyncCallback<DataElementList>() {
              @Override
              public void onFailure(Throwable rCaught) {
                handleLoginFailure(rCaught);
              }

              @Override
              public void onSuccess(DataElementList rResult) {
                handleLoginSuccess(rResult);
              }
            });
  }
Example #2
0
  /** ************************************* {@inheritDoc} */
  @Override
  protected void addComponents() {
    ContainerBuilder<Panel> aBuilder = createLoginComponentsPanel(AlignedPosition.CENTER);

    String sUserName = Cookies.getCookie(sUserCookie);

    addLoginPanelHeader(aBuilder, AlignedPosition.TOP);

    aUserField = addUserComponents(aBuilder, sUserName, bReauthenticate);
    aPasswordField = addPasswortComponents(aBuilder);
    aFailureMessage = addFailureMessageComponents(aBuilder);
    aLoginButton = addSubmitLoginComponents(aBuilder);

    if (aUserField != null) {
      aUserField.addEventListener(EventType.ACTION, this);
    }

    aPasswordField.addEventListener(EventType.ACTION, this);
    aLoginButton.addEventListener(EventType.ACTION, this);
    aFailureMessage.setVisible(false);
  }
Example #3
0
 /**
  * ************************************* Handles login failures. There are two ways this method
  * can be invoked. This class first tries to connect to the server with user name and password set
  * to NULL to check for an existing authentication. If that call fails the internal container
  * builder reference will not be NULL and will be used to create the login components to query for
  * the user login. The builder reference will then be set to NULL.
  *
  * @param rCaught The exception that occurred
  */
 protected void handleLoginFailure(Throwable rCaught) {
   aLoginButton.setEnabled(true);
   aFailureMessage.setVisible(true);
   rLoginHandler.loginFailed((Exception) rCaught);
 }