1

screenshot for description

I have a User that has already validated into the community initially with SMS. The next day, in addition to SMS, this User wants to also validate with EMAIL (because they don't have access to their cell phone to receive the code and need to log into the community with an unverified method). Is this possible?

SCENARIO:

Monday - User logs into Community for first time and registers using initSelfRegistration(SMS) > verifySelfRegistration(SMS).

Tuesday - User attempts to log into Community again, but now they want to use Email (because they don't have their mobile phone) - which method should I leverage from the documentation? (I thought it would be initVerificationMethod() or initRegisterVerificationMethod(), but neither seem to be successful)

ERROR MESSAGES:

initVerificationMethod() - User/Org configuration error: Could not send code due to :Email not verified (okay, I learned that this is for re-sending the verification if the User already has verified their method)

initRegisterVerificationMethod() - This operation is not allowed for internal user profiles. (okay, now I need to know how to allow an existing internal community user to add a verification method in addition to an existing one - so that both checkboxes are checked in the above screenshot: User Verified Mobile Number & User Verified Email)

How can I verify an existing community user (which has already self registered with SMS initially) with EMAIL before they log into the community? - see screenshot

thank you!!!

2
  • You need to call initVerificationMethod first. If that doesn't work, please edit your question and provide a Minimal, Reproducible Example
    – identigral
    Commented Feb 24, 2021 at 4:32
  • I really appreciate your comment @identigral, but I've tried that method, and when ran it returns the error message: "User/Org configuration error: Could not send code due to :Email not verified". I'll attempt to edit the question.
    – Spatula
    Commented Feb 24, 2021 at 13:00

2 Answers 2

0

I have a User that has already validated into the community initially with SMS. The next day, in addition to SMS, this User wants to also validate with EMAIL (because they don't have access to their cell phone and need to log into the community).

Yes it is possible if the user is logged in to community already. They need to verify it first.

Monday - User logs into Community for first time and registers using verifySelfRegistration(SMS)

Tuesday - User attempts to log into Community again, but now they want to use Email - which method should I leverage from the documentation? (I thought it would be initVerificationMethod() or initRegisterVerificationMethod(), but neither seem to be successful)

I am assuming in this the user has not verified the email already. In this case, unless you have verified the user identity, it is not possible to allow user to login with unverified methods.

How can you verify users:

Assuming user signs up via phone and has also added an email (which is not verified).

In this case you can send the the verification link to user email using System.UserManagement.sendAsyncEmailConfirmation as soon as the user is created. Once the user clicks on that links the email is also verified.

Assuming user signs up via phone and a dummy email was added (which is not verified).

In this case you should enable Identity verification for external users from session settings and ask user to change their email. A verification link will be sent by salesforce automatically and on clicking the link, the email will be verified and user can login with both. But you need to be logged in.

Assuming user signs up via phone and has been logged out of community and is trying to log in but has a valid email.

In this case unless you have signed in, you cannot do anything because there is no other way to verify user identity. You can of course send an sync confirmation to user email using method above using a custom page built in community.

3
  • I appreciate your response @manjit5190. It does not seem like what I need to do is possible. So my solution now is to: [1] when a User navigates to the URL for the first time they will be greeted with two options to register (EMAIL or SMS) > they choose, receive code, enter code, login to community. [2] when this User returns the following day, I only show the method they validated initially. They must login with this method. Then when they're logged in (either 2nd time or 1st time) I'm going to give them the option to add the other method of login validation.
    – Spatula
    Commented Feb 24, 2021 at 19:35
  • 1
    Resolution: users can't be logged out of the community, and validate both (individually) SMS and EMAIL methods. They have to login to validate the other.
    – Spatula
    Commented Feb 24, 2021 at 19:40
  • @Spatula I am curious to know how did you implement the login process in your community. Is it a visualforce page ? I am trying to deliver device activation code via SMS and not by email with permission set and profile setting but have been unable to do it yet. Commented Feb 2, 2022 at 22:38
0

My Resolution: Community Users cannot be logged out of the Community, and validate both (individually) SMS and EMAIL methods. They MUST be logged in to validate the other (initially they would validate one when they create their Community User). You do this using the following methods:

UserManagement.initRegisterVerificationMethod(method);

UserManagement.verifyRegisterVerificationMethod(code, method);

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .