@tin I've merged a new dashboard API endpoint for resetting 2FA for a given user: !152 (merged)
Besides that, I think you're still missing the information of whether a given user currently has 2FA configured. Let me see how to best present that, preferably in an existing endpoint I'd say.
!156 (merged) is a working solution for 2FA reset, assigned to @arie for review.
I created a new section called "User access" in the user modal, and removed the "delete" and "password link" buttons from the modal bottom.
This new section now holds password link, 2FA reset, and delete user.
Individual buttons are only visible if they can be used, aka "delete" doesn't show if I am opening my own user modal, and 2FA reset doesn't show if there is no 2FA set up.
Steps I took to verify:
Added 2FA to my profile
verified that "reset 2FA shows up for me, and not for other users without 2FA"
clicked on "reset 2FA," got alert modal confirming it has been deleted
checked in my SSO settings, and no 2FA present. yay
checked back on dashboard, no more 2FA for me
re-added 2FA, it correctly added
checked back on dashboard, 2FA reset option was present again