I am using a Custom Digital Experiences (Communities) Login Page with a custom controller to handle verification and login.
The expectation is, a Sales Agent will create an inactive Community User with an unverified Email Address attached to the user account.
Expected Behaviour
- The End-User will be presented with the Experience Login Page (custom)
- The End-User will enter arbitrary information (Agreement Number, Postcode)
- Our Custom Handler will use this to find the User Profile and trigger a Verification Email
- The End-User will enter the Verification code into another field and verify their email.
- Our custom Handler will use this to approve and verify their Authentication Method.
- The End-User will be logged into the Community.
I'm inexperienced with Communities so it's possible I'm missing something basic.
The Problem
When using the System.UserManagement Classes
- initRegisterVerificationMethod
- verifyRegisterVerificationMethod
as outlined in the documentation below. I'm given the Developer Console error 'This operation is not allowed for internal user profiles'
I've checked and ensured the following
- Running in Community Context (Community User, separate Cache-free browser)
- Community Activated
- Correct Permission Sets for Community User to login
- The Community user has the permission to verify
The concern is, I'm unaware of what Internal User is actually running the operation? Other than maybe the self-generated 'DIGITAL_EXPERIENCE_NAME Guest User' but I'm unable to find this user to check
I intentionally haven't included any code as I'm using a carbon-copy of the code snippet in the documentation provided (other than my using of Auth.VerificationMethod.EMAIL over SMS).
Any help / insight would be amazing thank you all.