CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Disable browser password save: revisited

by magosk » 13 Oct 2017 15:27

Hi and thanks for the suggestion, but I do get access violations in the (server) code when I later try to access properties of the edit controls for which I changed the name. Are you saying there is no way to forbid Chrome Mobile to store user names and passwords for the edit controls on a form?
magosk
 
Posts: 181
Joined: 07 Oct 2013 08:41

by Alexander Bulei » 13 Oct 2017 15:45

Hi magosk,

After that, to access to the control, you need find the control by name:

delphi code
IWCGJQEdit1:= FindComponentByName(NewName) as TIWCGJQEdit;


Are you saying there is no way to forbid Chrome Mobile to store user names and passwords for the edit controls on a form?


The way is check the settings of browser and disable the password manager.

Quoted:

You can do this way in google chrome by going to setting/Password and Forms > Disable [Enable Autofill to fill out web forms in a single click.] and Disable [Offer to save passwords with Google Smart Lock for Passwords.]


Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by magosk » 13 Oct 2017 16:33

Hi again! I meant if it was possible to tell Chrome to not store username and password from the web page code (similar what AutoComplete = False was meant to do)?

As for your suggested workaround, I have fixed the access to the edit controls so that the code works correct again (on the server side), but Chrome Mobile unfortunately still fills the password fields with (non-correct) values when you return to the login page after answering Yes.
magosk
 
Posts: 181
Joined: 07 Oct 2013 08:41

by magosk » 18 Oct 2017 09:49

Hi! Any update on this topic? I can tell you that I have made some testing on BrowserStack with various mobile browsers (Safari, Samsung Chrome and Firefox) and the problem is only there for Chrome. Also, although web frontend is not my area of expertise, I checked the links you gave in an earlier post. In one of them, one reply talks about setting autocomplete="new-password" rather than autocomplete="off" or autocomplete="false". Could this be something of interest?
magosk
 
Posts: 181
Joined: 07 Oct 2013 08:41

by Alexander Bulei » 18 Oct 2017 10:14

Hi magosk,

autocomplete="new-password"


We already add this attr when browser is chrome, anyway thanks ;)

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by magosk » 19 Oct 2017 14:39

Yes, I can see that if I enable developer tools in BrowserStack for Chrome. It seems like Google has decided to try to prevent the common workarounds for their policy to ignore autocomplete settings, but does not understand (or ignores) the problems they cause for many sites (like ours). Do you have any other ideas for workarounds? I saw something about setting some properties from JavaScript code rather than in the HTML. Or would it be possible to change some properties of the edit controls via Ajax from e.g. a TIWTimer.OnAsyncTimer event?
magosk
 
Posts: 181
Joined: 07 Oct 2013 08:41

by Alexander Bulei » 19 Oct 2017 15:06

Hi magosk,

You can try this workarround:

1. Set the input to READONLY
2. Implement the OnClick event, and disable the READONLY

I think, it should work fine :)

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by magosk » 20 Oct 2017 12:22

Hi and thanks for the tip! I combined it with the example I saw (it used OnFocus instead) and came up with the following workaround which seems to work fine (tested with a couple of physical devices plus various devices on Browserstack):

Code: Select all
procedure TEmMobileClientCGLoginWebDialog.IWAppFormCreate(Sender: TObject);

  procedure AddChromeAutoFillWorkaround(const Edits: array of TIWCGJQMEdit);
  var
    Edit: TIWCGJQMEdit;

    procedure SetTemporaryReadOnly;
    begin
      Edit.JQMEditOptions.EditTypeOptions.ReadOnly := True;
      Edit.JQMEditOptions.Events.OnFocus.Script :=
        'function (event){' +
        '  if (this.hasAttribute(''readonly'')){' +
        '    this.removeAttribute(''readonly'');' +
        '  }' +
        '}';
    end;

  begin
    Logger.ReportDebugUI(SafeFormat('Browser %s detected, adding workaround with temporary readonly'
      + ' attribute for edits to avoid problems with autofill', [WebApplication.Browser.BrowserName]));
    for Edit in Edits do
      SetTemporaryReadOnly;
  end;

begin
  {more code here...}
  inherited;
  if WebApplication.Browser is TChrome then {TChromeMobile inherits from TChrome}
    AddChromeAutoFillWorkaround([SubscriptionIDEdit, SubscriptionPasswordEdit, UserNameEdit,
      UserPasswordEdit, PasscodeEdit]);
  {more code here...}
end;


Does this look OK to you?
magosk
 
Posts: 181
Joined: 07 Oct 2013 08:41

Previous

Return to JQMEdit

cron

Who is online

Users browsing this forum: No registered users and 2 guests

Contact Us.