samples icon indicating copy to clipboard operation
samples copied to clipboard

MFA page: How to disable continue button only when the verification code has been sent

Open pd-sgdev1 opened this issue 3 years ago • 4 comments

Hi,

I would like to disable the Continue button while the e-mail verification code has not been sent (user has not clicked on the Send verification code button) - is that possible?

image

If you could lead me to an example or something similar, that would be great.

Thanks

pd-sgdev1 avatar Feb 22 '22 19:02 pd-sgdev1

Hi @pd-sgdev1 - Which page layout version are you using? If I recall correctly there was a bug in one of them that did not disable that button by default but this should be fixed in the latest version (urn:com:microsoft:aad:b2c:elements:contract:selfasserted:2.1.8)

https://docs.microsoft.com/en-us/azure/active-directory-b2c/page-layout

bolt-io avatar Mar 02 '22 17:03 bolt-io

I have updated datauri to urn:com:microsoft:aad:b2c:elements:contract:selfasserted:2.1.8 but still its taking time and user can click on continue button.. There should be loading dialog box with disable screen activity just like "Please wait loading information"

yogikale avatar Jul 28 '22 06:07 yogikale

Any updates to this?

Soggywaters avatar Mar 09 '23 21:03 Soggywaters

I have a simple solution that uses JQuery:

$("#continue").hide();
var observer = new MutationObserver(function (mutations) {
    mutations.forEach(function (mutationRecord) {
        $("#continue").show();
    });
});
var target = document.getElementById('email_success');
observer.observe(target, { attributes: true, attributeFilter: ['style'] });

What this is doing:

  1. First, it's hiding the Continue button.
  2. Then, it's using Javascript's MutationObserver to observe when the style attribute of div tag for the email_success label change. This will only change once a user has successfully verified their email with the emailed code.
  3. Reveal the Continue button.

The email_success div tag is the ID of the div tag for a successfully verified code label. I think it changes based on the outclaim name in your b2c policy.

It's not a very pretty way but it works for me. If they end up changing their UI for the self assertion, then this might break. I'm using urn:com:microsoft:aad:b2c:elements:contract:selfasserted:2.1.9 UI format. And if it isn't obvious - I could have only done this via a custom UI by adding the above code in a <Script> tag at the bottom of my HTML for this page. I still think Microsoft should update this to be an option within the B2C custom policies.

Soggywaters avatar Apr 04 '23 21:04 Soggywaters