3

I am trying to use the password field type on some settings items to store data instead of using configs, however when reading its values in code (for example item["passwordfield"]) we are getting "••••" instead of the actual text. In the sitecore documentation it is stated:

    The Password field type stores plain text, but masks input in the Content Editor. 
    Sitecore does not hash or otherwise mask the provided text in the database.

However if I look in the database the value saved is still •••• enter image description here

I tried with different sitecore versions, but this behavior is the same on both 9.2 and 10.1. Not sure if I am missing or doing something wrong, has anyone achieved this? Thanks for the help.

1

1 Answer 1

0

First of all, I think it is makes sense to create a custom item with a Password field type. Then you can create a new item and try to save it with some data in Content Editor. Then you can check this value in the Database. You can also serialize this item and check how it looks file system. If this looks good then I see the following possible reasons:

  • specific Sitecore version issue
  • custom coding issue
  • serialization issue

Update: sometimes, when switching the raw value to a normal value, and vice versa, a popup box shows up to save, do not click on the "yes" button. Instead, save the item before switching. Otherwise, the raw value would get changed to be encrypted with ••••

2
  • The issue is happening on a vanilla sitecore instance on different versions. Also in the serialized file the value of the password field is still shown as ••••. Commented Sep 14, 2021 at 8:08
  • Just verified on vanilla Sitecore.NET 10.1.1 (rev. 005862). It displays a real password value in Content Editor when ticking "Raw values" checkbox in "View" tab. Can you please check "/sitecore/system/Field types/Simple Types/Password" item in core DB? Maybe this item was overwritten somehow?
    – Alexander
    Commented Sep 14, 2021 at 8:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.