Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Bug in PasswordItem

    hey,

    since last chrome update, the browser supports storing and restoring passwords for javascript fields... chrome puts the values correct into the login and password fields... but the methods txtPassword.getValue() or txtPassword.getValueAsString() are returning null.

    If the user clicks with a simple mouse click into the password field, the same methods are returning the correct password.

    Code:
    PasswordItem txtPassword = new PasswordItem( "txtPassword", Pass );
                    txtPassword.setWidth( "*" );
                    txtPassword.setLength( 30 );
                    txtPassword.setRequired( true );
    this happens with latest SmartGWT 4.1p

    Thanks
    Andy

    #2
    We'll look into this issue and follow up with more information.

    Regards
    Isomorphic Software

    Comment


      #3
      As always... Thanks for your help!!!

      Comment


        #4
        We're actually having some trouble reproducing this issue.
        Our default settings for FormItems prevent Chrome from offering to auto-fill, but even with these settings reversed, we're not being offered the chance to remember password item data at all.

        If you could show us your full EntryPoint class which defines and draws the login form, and also let us know your exact browser info (OS and Chrome version), we will take another look.

        Also we assume this is happening in compiled mode, not dev/hosted mode - is that correct?

        Thanks
        Isomorphic Software

        Comment


          #5
          ok... which Chrome Version did you used? They change the password manager since Version 34

          http://www.theregister.co.uk/2014/04/09/chrome_makes_new_password_grab_in_version_34/

          About the code.... I will post this code soon. I need some time to take the right parts out of my main method.

          Comment


            #6
            So here is the code:

            Code:
            public VLayout getLoginForm()
                {
            
                    VLayout layout = new VLayout();
                    layout.setLayoutAlign( VerticalAlignment.CENTER );
                    {
                        Canvas spacerColumn = new Canvas();
                        spacerColumn.setWidth( "100%" );
            
                        Canvas spacerLine1 = new Canvas();
                        spacerLine1.setWidth( "100%" );
                        spacerLine1.setHeight( "20%" );
            
                        Canvas spacerLine2 = new Canvas();
                        spacerLine2.setWidth( "100%" );
                        spacerLine2.setHeight( "10%" );
            
                        Img imageLogo = new Img( "logo/" + GWebAdmin.ident + "_logo.png", 280, 115 );
                        HLayout logoLayout = new HLayout();
                        logoLayout.addMember( spacerColumn );
                        logoLayout.addMember( imageLogo );
                        logoLayout.addMember( spacerColumn );
                        imageLogo.setCursor( Cursor.HAND );
                        logoLayout.setHeight( imageLogo.getHeight() );
                        imageLogo.addClickHandler( new ClickHandler()
                        {
            
                            @Override
                            public void onClick( ClickEvent event )
                            {
                                if ( GWebAdmin.ident.toLowerCase().equals( "personal" ) )
                                {
                                    com.google.gwt.user.client.Window.open( "http://www.uni-saarland.de/campus/service-und-kultur/dienstleistungen-der-verwaltung/personal/persabt.html",
                                                                            "_blank", "" );
                                }
                                else if ( GWebAdmin.ident.toLowerCase().equals( "sepia" ) )
                                {
                                    com.google.gwt.user.client.Window.open( "http://www.uni-saarland.de", "_blank", "" );
                                }
                            }
                        } );
                        {
            
                            editorForm = new DynamicForm();
                            editorForm.setAutoFocus( true );
                            editorForm.setWidth( "100%" );
            
                            HeaderItem header = new HeaderItem();
                            header.setDefaultValue( constants.textLoginInstruction() );
                            header.setAlign( Alignment.LEFT );
            
                            txtLogin = new TextItem();
                            txtLogin.setName( "username" );
                            txtLogin.setTitle( constants.fieldLoginUser() );
                            txtLogin.setWidth( "*" );
                            txtLogin.setLength( 30 );
                            txtLogin.setRequired( true );
                            txtLogin.setStartRow( true );
                            txtLogin.setEndRow( true );
                            txtLogin.setColSpan( 3 );
                            txtLogin.setWrapTitle(false);
                            txtLogin.addKeyDownHandler( new KeyDownHandler()
                            {
            
                                @Override
                                public void onKeyDown( KeyDownEvent event )
                                {
                                    if ( event.getKeyName().equals( "Enter" ) )
                                    {
                                        login();
                                    }
                                }
                            } );
            
                            txtPassword = new PasswordItem();
                            txtPassword.setWrapTitle(false);
                            txtPassword.setName( "password" );
                            txtPassword.setTitle( constants.fieldLoginPassword() );
                            txtPassword.setWidth( "*" );
                            txtPassword.setLength( 30 );
                            txtPassword.setRequired( true );
                            txtPassword.setStartRow( true );
                            txtPassword.setEndRow( true );
                            txtPassword.setColSpan( 3 );
                            txtPassword.addKeyDownHandler( new KeyDownHandler()
                            {
            
                                @Override
                                public void onKeyDown( KeyDownEvent event )
                                {
                                    if ( event.getKeyName().equals( "Enter" ) )
                                    {
                                        login();
                                    }
                                }
                            } );
            
                            ButtonItem buttonLogin = new ButtonItem( "buttonReset", constants.toolBarLogin() );
                            buttonLogin.setWidth( "*" );
                            buttonLogin.setIcon( "icons/32x32/login.png" );
                            buttonLogin.addClickHandler( new com.smartgwt.client.widgets.form.fields.events.ClickHandler()
                            {
                                public void onClick( com.smartgwt.client.widgets.form.fields.events.ClickEvent event )
                                {
                                    login();
                                }
                            } );
            
                            ButtonItem buttonReset = new ButtonItem( "buttonLogin", constants.toolBarReset() );
                            buttonReset.setWidth( "*" );
                            buttonReset.setIcon( "icons/32x32/remove.png" );
                            buttonReset.addClickHandler( new com.smartgwt.client.widgets.form.fields.events.ClickHandler()
                            {
                                public void onClick( com.smartgwt.client.widgets.form.fields.events.ClickEvent event )
                                {
                                    txtLogin.clearValue();
                                    txtPassword.clearValue();
                                    txtLogin.setSelectionRange( 0, 0 );
                                }
                            } );
            
                            txtErrors = new StaticTextItem( "Errors" );
                            txtErrors.setShowTitle( false );
                            txtErrors.setAlign( Alignment.CENTER );
            
                            txtInfo = new StaticTextItem( "Info" );
                            txtInfo.setShowTitle( false );
                            txtInfo.setAlign( Alignment.CENTER );
                            txtInfo.setValue( "<b><font color=\"grey\">" + constants.txtSupportedBrowsers() + "</font></b>" );
            
                            txtBrowser = new StaticTextItem( "Browser" );
                            txtBrowser.setShowTitle( false );
                            txtBrowser.setAlign( Alignment.CENTER );
            
                            txtSupport = new StaticTextItem( "Support" );
                            txtSupport.setShowTitle( false );
                            txtSupport.setAlign( Alignment.CENTER );
                            txtSupport.setValue( constants.txtSupportLink() );
            
                            txtLoginRequest = new StaticTextItem( "Manual" );
                            txtLoginRequest.setShowTitle( false );
                            txtLoginRequest.setAlign( Alignment.CENTER );
                            txtLoginRequest.setValue( "<a href=\"http://www.hiz-saarland.de/organisatorisches/servicekontakte/antraege/\" target=\"_blank\">"
                                + constants.txtLoginRequest() + "</a>" );
            
                            SpacerItem columnSpacer = new SpacerItem();
            
                            header.setStartRow( false );
                            header.setEndRow( true );
                            header.setColSpan( 3 );
            
                            buttonLogin.setStartRow( false );
                            buttonLogin.setEndRow( false );
                            buttonReset.setStartRow( false );
                            buttonReset.setEndRow( false );
            
                            txtInfo.setStartRow( true );
                            txtInfo.setEndRow( true );
                            txtInfo.setColSpan( 5 );
                            txtInfo.setHeight( 20 );
                            txtInfo.setAlign( Alignment.CENTER );
            
                            txtBrowser.setStartRow( true );
                            txtBrowser.setEndRow( true );
                            txtBrowser.setColSpan( 5 );
                            txtBrowser.setHeight( 40 );
                            txtBrowser.setAlign( Alignment.CENTER );
            
                            txtSupport.setStartRow( true );
                            txtSupport.setEndRow( true );
                            txtSupport.setColSpan( 5 );
                            txtSupport.setHeight( 20 );
                            txtSupport.setAlign( Alignment.CENTER );
            
                            txtLoginRequest.setStartRow( true );
                            txtLoginRequest.setEndRow( true );
                            txtLoginRequest.setColSpan( 5 );
                            txtLoginRequest.setHeight( 5 );
                            txtLoginRequest.setAlign( Alignment.CENTER );
            
                            txtErrors.setStartRow( true );
                            txtErrors.setEndRow( true );
                            txtErrors.setColSpan( 5 );
                            txtErrors.setHeight( 20 );
                            txtErrors.setAlign( Alignment.CENTER );
            
                            editorForm.setAutoFocus( true );
                            editorForm.setNumCols( 5 );
                            editorForm.setColWidths( "*", 110, 110, 150, "*" );
                            editorForm.setFields( columnSpacer, txtLogin, txtPassword, columnSpacer, buttonLogin, buttonReset,
                                                  columnSpacer, columnSpacer, txtErrors, columnSpacer, txtInfo, columnSpacer,
                                                  txtBrowser, columnSpacer, txtSupport, columnSpacer, txtLoginRequest );
            
                        
                            layout.addMember( logoLayout );
                            layout.addMember( editorForm );
            
                        }
                    }
            
                    if ( mainWindow.getUserAgent().toLowerCase().contains( "mobile" )
                        || mainWindow.getUserAgent().toLowerCase().contains( "iphone" )
                        || mainWindow.getUserAgent().toLowerCase().contains( "ipod" )
                        || mainWindow.getUserAgent().toLowerCase().contains( "ipad" )
                        || mainWindow.getUserAgent().toLowerCase().contains( "android" )
                        || mainWindow.getUserAgent().toLowerCase().contains( "blackberry" ) )
                    {
                        txtBrowser.setValue( "<b><font color=\"green\">Browser Engine: " + mainWindow.getUserAgent()
                            + "<br>Betriebssystem: " + mainWindow.getOperatingSystem() + "</font></b>"
                            + "<br><br><br><b><font color=\"red\">" + constants.txtDesktopOption() + "</font></b>" );
                    }
                    else if ( mainWindow.getUserAgent().toLowerCase().contains( "opera" )
                        || mainWindow.getUserAgent().toLowerCase().contains( "presto" ) )
                    {
                        txtBrowser.setValue( "<b><font color=\"red\">" + constants.txtOperaWarning() + "</font></b>" );
                    }
            
                    else
                    {
                        txtBrowser.setValue( "<b><font color=\"green\">" + constants.txtBrowserEngine() + ": "
                            + mainWindow.getUserAgent() + "<br>" + constants.txtOperationSystem() + ": "
                            + mainWindow.getOperatingSystem() + "</font></b>" );
            
                    }
            
                    return layout;
            
                } // End of method
            Last edited by andyx1975; 9 May 2014, 05:25.

            Comment


              #7
              here's a screenshot which shows the error... as you can see the field is prefilled and an error appears.
              Attached Files

              Comment


                #8
                Ok - we've managed to reproduce this issue and have made a change to address it. Please try the next nightly build (May 10 or above) in the 9.1p or 10.0d branches.

                Regards
                Isomorphic Software

                Comment


                  #9
                  Thank you very much.... it is working great!!!

                  Comment


                    #10
                    After updating to build "SmartClient Version: v9.1p_2014-05-11/Pro Deployment (built 2014-05-11)", all of our forms with a PasswordItem display the field values, then the values quickly disappear.

                    The problem still exists with build "SmartClient Version: v9.1p_2014-05-13/Pro Deployment (built 2014-05-13)"

                    This problem only happens on Chrome, and it only happens for forms with a PasswordItem. I am using Chrome Version 34.0.1847.137.

                    When it happens, the values for other TextItem fields disappear, but the values for SelectItem fields don't seem to disappear.

                    This issue does not exist in build "SmartClient Version: v9.1p_2014-04-29/Pro Deployment (built 2014-04-29)" or earlier.

                    Can you please confirm something hasn't broken with respect to the PasswordItem?

                    Thanks

                    Comment


                      #11
                      Hmm - your description of *where* this occurs (Chrome only, only in forms containing a PasswordItem) pretty clearly indicates that our change to address the original issue is at fault here, but we can't reproduce the problem.
                      Our test case is based upon your sample from earlier - here's the EntryPoint class:

                      Code:
                      import java.util.HashMap;
                      
                      import com.google.gwt.core.client.EntryPoint;
                      import com.smartgwt.client.widgets.form.DynamicForm;
                      import com.smartgwt.client.widgets.form.fields.ButtonItem;
                      import com.smartgwt.client.widgets.form.fields.PasswordItem;
                      import com.smartgwt.client.widgets.form.fields.SubmitItem;
                      import com.smartgwt.client.widgets.form.fields.TextItem;
                      import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
                      import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
                      
                      public class LoginAutoFillIssue implements EntryPoint {
                      
                      	private DynamicForm editorForm;
                      	private TextItem txtLogin;
                      	private PasswordItem txtPassword;
                      
                      
                      	@Override
                      	public void onModuleLoad() {
                      		getLoginForm().draw();		
                      	}
                      	
                      	public DynamicForm getLoginForm() {
                      		editorForm = new DynamicForm();
                      		editorForm.setCanSubmit(true);
                      		
                      		txtLogin = new TextItem("username");
                      		txtPassword = new PasswordItem("password");
                      		txtPassword.setRequired(true);
                      		
                      		editorForm.setAction("LoggedIn.html");
                      		
                      		ButtonItem validator = new ButtonItem("Validate");
                      		validator.addClickHandler(new ClickHandler() {
                      			
                      			@Override
                      			public void onClick(ClickEvent event) {
                      				event.getForm().validate();
                      				
                      			}
                      		});
                      		
                      		editorForm.setItems(txtLogin, new TextItem("extraItem"), txtPassword, validator, new SubmitItem());
                      
                      
                      		HashMap values = new HashMap();
                      		values.put("username", "Bob");
                      		values.put("extraItem", "Extra Val");
                      		values.put("password", "Kittens");
                      		
                      		editorForm.setValues(values);
                      
                      		return editorForm;
                      		
                      	}
                      }
                      Unaltered, this shows the values explicitly applied via the "values" map. If we remove the setValues call, the form shows with empty values, or auto-populates with saved Login username/pwd values if you've saved out the values using Chrome's password management / autofill feature.

                      Can you confirm whether you see the problem you describe (items being cleared) with this test case. If not, can you try to put together something we can run which does demonstrate the problem?

                      Thanks
                      Isomorphic Software

                      Comment


                        #12
                        Just to clarify, the original post does not belong to us, it was simply relevant because the problem began for us after changes relating to this post were committed to a build.

                        Comment


                          #13
                          Ah - got it! Sorry for the confusion - we should have checked the username more carefully.

                          However the status is basically the same - we need to know how to reproduce this problem. It's obviously serious and somewhat urgent to resolve but not something we're seeing in house so we need to see it to determine what's going on.

                          If you can show us a way to reproduce - ideally a standalone test case which demonstrates the problem, or point to a sample which exhibits the problem it's going to make resolving this much quicker and simpler.

                          Thanks
                          Isomorphic Software

                          Comment


                            #14
                            To reproduce, click Refresh on the form.

                            Code:
                            public class Sandbox1 implements EntryPoint {
                            
                                private DynamicForm form;
                            
                                @Override
                                public void onModuleLoad() {
                                    HLayout layout = new HLayout();
                                    form = new DynamicForm();
                                    TextItem user = new TextItem("user");
                                    PasswordItem pwd = new PasswordItem("password");
                                    form.setItems(user, pwd);
                                    IButton clear = new IButton("Clear");
                                    clear.addClickHandler(new ClickHandler() {
                                        @Override
                                        public void onClick(ClickEvent event) {
                                            form.editNewRecord();
                                        }
                                    });
                                    IButton refresh = new IButton("Refresh");
                                    refresh.addClickHandler(new ClickHandler() {
                                        @Override
                                        public void onClick(ClickEvent event) {
                                            Record r = new Record();
                                            r.setAttribute("user", "Bob-" + System.currentTimeMillis());
                                            r.setAttribute("password", "xxx123");
                                            form.editRecord(r);
                                        }
                                    });
                                    HLayout buttonLayout = new HLayout();
                                    buttonLayout.addMember(clear);
                                    buttonLayout.addMember(refresh);
                                    layout.addMember(form);
                                    layout.addMember(buttonLayout);
                                    layout.draw();
                                }
                            }
                            Last edited by stonebranch2; 14 May 2014, 11:26.

                            Comment


                              #15
                              Thanks - we're checking it out. We'll let you know if we have a problem reproducing / when we have a fix.

                              Comment

                              Working...
                              X