Solved

Prevent auto fill-in of password field in custom entity

  • 2 March 2021
  • 2 replies
  • 93 views

Userlevel 2
Badge

Hello,

I need a configure screen that contains also password and store them to DB.

I set the TextMode to “Password” to hide it.

    <px:PXTextEdit ID="edPassword" runat="server" DataField="Password" TextMode="Password" />

 

But the web browser (Chrome and Firefox) fills-in the login password into this field.

Is there a possibility to prevent that in code?

 

Thanks,

Michael

icon

Best answer by Naveen Boga 2 March 2021, 09:48

View original

2 replies

Userlevel 7
Badge +19

Hi @mhaps,

That is browser behavior, which is storing the password values in the browser caches and when you open the screen it is populating on the screen.

If you wanted to provide security to those fields you can use the Acumatica default Encryption/Decryption technique, and this is the standard approach.

The below example might help you if you use default Acumatica encryption/decryption.

 

DAC field should be decorated with this attribute for encryption “[PXRSACryptString(IsUnicode = true)]”

DAC Field:

 #region AuthToken

        [PXRSACryptString(IsUnicode = true)]
        [PXDefault()]
        [PXUIField(DisplayName = "Auth Token")]
        public virtual string AuthToken { get; set; }
        public abstract class authToken : IBqlField { }

        #endregion
Below is the code for decrypting the values “RowSelected Event”



 protected virtual void DACNAME_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            DACNAME row = e.Row as DACNAME;
            if (row != null)
            {
                PXRSACryptStringAttribute.SetDecrypted<DACName.authToken>(sender, row, true);

            }

       }

 

 

Userlevel 6
Badge +3

hi @mhaps 

If you don’t need encrypt the data you can have it in simple way like below example.

This will not hold any data on the load.

        [PXDBString(100, IsUnicode = true, InputMask = "")]
        [PXUIField(DisplayName = "Bearer Token", Required = true)]
        public virtual string BearerToken { get; set; }
        public abstract class bearerToken : BqlString.Field<bearerToken> { }


Hope this may helps you.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved