I am creating an appliaction which requires user authentication. I have one 
problem when I'm trying to log in. When I type a correct username and 
password, the onSuccess method is called. But when I type a wrong one, or 
empty fields, then the onFailure() method is NOT called.

I really want to know why this is happening. Because I wan't to display 
some sort of dialogbox when the username or password is incorrect.


This is the ClickHandler, which takes the username and password from the 
fields:


loginButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            String username = usernameBox.getText();
            String password = passwordBox.getText();
            performUserConnection(username, password);
        }
    });



And this is the method that performs the user conenction, which as I said, 
works if I have a correct username/ password. It displays my alert message, 
but it does not display any alert message if it's not correct.


private static void performUserConnection(String username, String password) {
    DBConnectionAsync rpcService = (DBConnectionAsync) 
GWT.create(DBConnection.class);
    ServiceDefTarget target = (ServiceDefTarget) rpcService;
    String moduleRelativeURL = GWT.getModuleBaseURL() + "DBConnectionImpl";
    target.setServiceEntryPoint(moduleRelativeURL);

    rpcService.authenticateUser(username, password, new AsyncCallback<User>() {

        @Override
        public void onSuccess(User user) {
            Window.alert("TRALALA. Username: " + user.getUsername());
        }

        @Override
        public void onFailure(Throwable caught) {
            Window.alert("LALALALAL");
            // DialogBox dialogBox = createDialogBox();
            // dialogBox.setGlassEnabled(true);
            // dialogBox.setAnimationEnabled(true);
            // dialogBox.center();
            // dialogBox.show();
        }
    });}


Thanks in advance
 

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to