Remove old password field from User Profile block (use case: users are initially invited with magic links)

<script>
   window.addEventListener('block-loaded-user-accounts1', () => {
   		document.querySelectorAll('#user-accounts1 form')[1].children[1].style.display = 'none'
   });
</script>

Insert this into Page Settings>Custom Code>Header or Footer and replace user-accounts1 to your respective User Profile block name

1 Like

This code wasn’t working as of 1/5/23.

Hi @Ben just checked the code and it does work for me. Are you logged in with a magic link and did you replace the user-accounts1 with your own block name?

Hi @Maria. Yes, it works now while logged in with a magic link with the corresponding block name plugged into the code on a new user block that is added, however the code does not work for previous versions of the block even if they are updated.

When you posted this code, back in October, it worked. But now it doesn’t work unless it is applied to a brand new block added. Very strange.

Hey @Ben we might have had a bug that got fixed which is why it doesn’t work on old versions. Please, use it on the new block If possible.

BTW, it is difficult to test the User profile block in the studio and preview mode for this scenario. I’m finding that users removed from the Users table, then added again for invites with a magic link, do not always show up in the ‘Preview as’ list of users. Also, if they do populate, the preview doesn’t always refresh to reflect the new user selected.