New add-on: LoginForm

Not this time. Sorry, I forgot to reRTFJD. I’ll test it next week. Thanks.

I’m new to vaadin and I think I’m missing something cause I can’t get the TestUi class to work.

I’m getting the error “Widgetset ‘com.vaadin.DefaultWidgetSet’ does not contain implementation for com.test.TestUi.SimpleLoginForm. Check its component connector’s @Connect mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions”

I followed the instructions: I copied the jar into WEB-INF/lib and compiled the widge set. I’m using Maven and it’s compiling the widge set and adding the line " " to the widge set config file in my application.

What could I be doing wrong?

This has nothing to do this this particular add-on, you have to recompile your widget set as for any add-on with client side functionality.

Thanks a lot for answering! sorry it’s the first add-on I have tried, anyway I’ll ask at the add-ons vaadim forum cause as I mentioned I recompiled it and it succeeded, that’s why I don’t get what I’m doing wrong.

Hi,

I just want to be able to add the email field. Is there a simple way?

Thanks,
Greg

You mean to add a another field to the login form? You could do that by implementing LoginForm, but it will not have the desired effect. The password manager will not be able to adjust the email field based on the user name field.

I simple want an email field that works with browser’s autofill features. No password or button.
thx.

Hi.

Great add-on, looks like something we’ll need and use.

One problem with Firefox (version 35.0)

If you type the username for which a password was previously recorded, and press enter, it invokes the login process (as expected). However, the password is not auto-filled correctly. In fact, you can see that the password field does actually take the value of the recorded password BRIEFLY (the correct amount of dots appear), but at the time login() is called on the LoginForm(), the password is at the value it was in it initially (e.g. blank if first time on the screen).

I hope I have explained this OK!

Things work ok on Chrome.

Cheers,
Lee.

I use it on Firefox 35 myself and cannot reproduce this problem. Have you recompiled your widgetset? If yes, please post your code and describe in detail, how you select the user.

I can reproduce this. You have to type the username without selecting from the popup to see this problem.

Got it, I will check if I can do something about that.

Yes. As T Gergely said. Just type user name, but dont press tab/or select from list by clicking. Press enter. The logon process is started. In Chrome, the password field is autofilled before the login request. In Firefox, something goes wrong.

Here is my code for setting up the form. Its not runnable, but it shows that I am doing nothing out of the ordinary…

My fields are set up externally, as I need a reference to them for i18n etc.
Other non-related components are added to my mainLayout (which contains the logon form) before it is made visible.

    public class MyLoginForm extends LoginForm {
        @Override
        protected Component createContent(TextField userNameField, PasswordField passwordField, Button loginButton) {
            GridLayout gl = new GridLayout(2,3);            
            gl.setWidth("100%");
            gl.setHeight(null);            
            gl.setSpacing(true);
            gl.setMargin(new MarginInfo(true, true, false, true));        
                                                   
            // column containing text fields is the one that will expand
            gl.setColumnExpandRatio(1, 1);                
            gl.addComponent(mainUsernameLabel, 0, 0);
            gl.addComponent(userNameField, 1, 0);        
                        
            gl.addComponent(mainPasswordLabel, 0, 1);
            gl.addComponent(passwordField, 1, 1);
            gl.addComponent(loginButton, 1, 2);
            
            return gl;
        }

        @Override
        protected void login(String userName, String password) {
            System.out.println(
                "Logged in with user name " + userName +
                " and password of length " + password.length()
            );
            
            mainUsernameTextField.setComponentError(null);
            mainPasswordField.setComponentError(null);  
            
            presenter.onStandardLoginRequest(userName, password);
        }

        @Override
        protected TextField createUserNameField()
        {
            return mainUsernameTextField;
        }

        @Override
        protected PasswordField createPasswordField()
        {
            return mainPasswordField;
        }

        @Override
        protected Button createLoginButton()
        {
            return mainLoginButton;
        }                                
    }
    
    @Override
    public void initialise(Object o)
    {     
        super.initialise(o);
        
        // components for logon
        mainUsernameLabel = new Label();
        mainUsernameLabel.setSizeUndefined();  
        
        mainUsernameTextField = new TextField();
        mainUsernameTextField.setSizeUndefined();
        
        mainPasswordLabel = new Label();
        mainPasswordLabel.setSizeUndefined();
        
        mainPasswordField = new PasswordField();
        mainPasswordField.setSizeUndefined();        
        
        mainLoginButton = new DefaultButton();
                                
        mainLayout = new VerticalLayout();
        
        mainLayout.setWidth("100%");
        mainLayout.setHeight(null);
        
        MyLoginForm form = new MyLoginForm();
                               
        mainLayout.addComponent(form);

        // set static I18N strings
        setStaticI18NStrings();
    }

Please try 0.4.1, it should fix this problem.

Will do, I’ll let you know!

Hi.

Sorry to report, but it looks like the issue still exists. I can see the password being applied briefly before it appears to be cleared. On server, it’s 0 in length.

As before, everything fine on Chrome.

Used loginform-0.4.1.jar, widgetset recompiled, all existing privacy settings & cache cleared on browser.

Cheers,
Lee.

OK, please try again with 0.4.2, I think I have found a better approach now.

Good news - that works!
Bad news - but introduces another problem.

Whatever is in the password field when you press enter then becomes the new value according to the password manager (or at least it asks if you want to update the password for the user).

To replicate.

  1. Log in as a user with a valid password. This gets remembered by the password manager.
  2. Log out.
  3. Go to log in again, but:
    a) first enter a completely rubbish in the password field.
    b) enter your username as in 1, and press enter whilst on the username field to login

Whilst the login will work (as the password is applied), the password manager will ask if you want to update the stored password with the rubbish value as entered in (a).

As a user, you’ll probably say yes, as the login has been successful.
The result of this is that the next time a login is attempted, the password manager uses the rubbish password, and the login fails.

Again, seems only to be an issue in firefox.

This problem actually existed before as well. I’ve fixed it in 0.4.3. Can you check?

Checked, and appears to be OK now.

Thanks very much, appreciated!

Thanks for your help!