Azure B2C Localization of Show Password / Password Toggler label - azure-ad-b2c

I have successfully been able to localize the text of all elements in our B2C custom policy files, with the exception of the 'show password' / password toggler labels, which stubbornly refuse to change from their default values.
When using F12 I can examine the code for the page for both the Password and the Password Toggler labels:
<label for="password">#Password</label>
...
<label for="passwordtoggler">show password</label>
They both have the same format, therefore I would expect to be able to localize these both in the same way in the custom policy file.
I can localize the Password label using:
<LocalizedString ElementType="ClaimType" ElementId="password" StringId="DisplayName">#Password</LocalizedString>
However if I try to do the same for the password toggler element:
<LocalizedString ElementType="ClaimType" ElementId="passwordtoggler" StringId="DisplayName">#Show Password</LocalizedString>
Then this does not work, and still just shows the default text of 'show password', and not '#Show Password'
Has anyone been able to localize this label?

The password toggler is front end JavaScript, and it’s not delivered by custom policy configuration, therefore cannot be customised by the custom policy localisation.
https://learn.microsoft.com/en-us/azure/active-directory-b2c/javascript-and-page-layout?pivots=b2c-user-flow#show-or-hide-a-password
You can use JS to read the SETTINGS object, which will contain the language and then do your own language customisation, or deliver dynamic HTML pages using dynamic page customisation.
https://learn.microsoft.com/en-us/azure/active-directory-b2c/customize-ui-with-html?pivots=b2c-custom-policy#configure-dynamic-custom-page-content-uri

Related

Is there a way to force email verification in Azure B2C before allowing user to click Create or update the vague error message when not verified?

I have an Azure AD B2C Sign up and sing in policy and would like to improve the user experience for creating an account. If a new user does not click the Send verification code button and fills out the remainder of the form fields when creating a new Azure AD B2C account they receive a "A required field is missing. Please fill out all required fields and try again.":
Most users are confused on what the missing required field is, as there is no input simply a button to Send verification code. I would like to either force a user to click the button and verify their email before they are able to click the Create button or provide a more descriptive error message like: "A required field is missing or the Email Verification Code has not been sent/verified".
Does anyone know how I can do either of these without going down the custom page content route?
If it is ,Signin sign up user flow ,error messages or flow can be customized only through user interface with HTML templates ,which looks like don't prefer as you said
"without going down the custom page content route"
You can make use of localization , if you use Custom policies which uses TrustFrameworkExtensions.xml
The IDs for a content definition with an ID of api.localaccountsignup. Localization string IDs - Azure Active Directory B2C | Microsoft Docs / localization-string-ids
You need to make changes in the appropriate “api.xxx” action. In this
case, it’s “api.localaccountsignup”.
The XML changes to the TrustFrameworkExtensions.xml file are:
ID : error_requiredFieldMissing
Default value : A required field is missing. Please fill out all required fields and try again.
<LocalizedResources Id="api.localaccountsignup.en">
...
<LocalizedString ElementType="UxElement" StringId="error_requiredFieldMissing">A required field is missing. Please fill out all required fields and try again.</LocalizedString>
...
<LocalizedResources Id="api.localaccountsignup.en">
We may need to Change to
<Localization Enabled="true">
<SupportedLanguages DefaultLanguage="en" MergeBehavior="ReplaceAll">
<SupportedLanguage>en</SupportedLanguage>
</SupportedLanguages>
<LocalizedResources Id="api.localaccountsignup.en">
#Change the error message here
<LocalizedStrings>
<LocalizedString ElementType="UxElement" StringId="error_requiredFieldMissing">A required field is missing or the Email Verification Code has not been sent/verified as not clicked on send verification code</LocalizedString>
</LocalizedStrings>
</LocalizedResources>
</Localization>
Please Refer:
Customising the message/error text in Azure AD B2C custom policies | by Rory Braybrook
get-a-proper-error-message or customising/localizin the error in b2c-custom-policies
Localization string IDs - verification-display-control| Microsoft Docs
Separate the email verification code step from the actual signup, might be a workaround for you.
The below custom policy shows how to achieve this:
Separate the Email Verification and User Registration into 2 separate screens
Live Demo

Azure b2c custom email verification with SendGrid for reset password policy

I am follow tutorial
Custom email verification with SendGrid, but I want to do that for reset password policy.
Everything working fine except that for <ContentDefinition Id="api.localaccountpasswordreset"> my <LocalizedString> elements are not display.
TechnicalProfile in <UserJourney>
And element's that are not display
Thanks for any advice.
You are using Display Controls to integrate Sendgrid. The correct stringIds are found here.
verification_control_but_change_claims
verification_control_fail_send_code
verification_control_fail_verify_code
verification_control_but_send_code
verification_control_but_send_new_code
verification_control_but_verify_code
verification_control_code_sent

ADB2C Password Reset Fails

We use ADB2C custom policies with MFA enabled. Currently our password reset is failing. When a user tries to reset password we get the "Account could not be found for the Provided UserID" error
If I manually copy the Alternate email field to the Email field on the portal and try to reset my password it works. My hypothesis is that something in the custom policy chain is causing the email claim to not persist correctly on sign up? (Alternate email seems to persist fine)
In our custom policy I do see the following in the extensions policy:
<PersistedClaimClaimTypeReferenceId="email"PartnerClaimType="strongAuthenticationEmailAddress"/>
in the UserWriteUsingLogonName technical profile, which is what's invoked by the Self Asserted 'LocalAccountSignUpWithLogonName' technical profile (corresponds to a user signing up).
This is a snippet of the TrustFrameWorkExtensions File
Here are snippets from the TrustFrameworkBase file.
Here is the self-asserted technical profile for Sign In and Sign Up
We use the default password reset B2C_1_PasswordReset

Customising/Localizin the error text in Azure AD B2C custom policies

I am unable to customize the following error message in azure ad b2c custom policy.
This message comes in password reset policy ,if entered email address doesn't exist.
to localize this i used following id but its not working.
<LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfClaimsTransformationStringsAreNotEqual">sample text</LocalizedString>
You need to use a different string id - UserMessageIfClaimsPrincipalDoesNotExist.
<LocalizedString ElementType="ErrorMessage"
StringId="UserMessageIfClaimsPrincipalDoesNotExist">sample test.</LocalizedString>
https://learn.microsoft.com/en-us/azure/active-directory-b2c/localization-string-ids

Can we directly provide a policy name for Forgot your password link on Azure AD B2C SignIn Policy

I am using custom SignUp/SignIn policies and custom UI.
I have been through the posts on stackoverflow for "Forgot Your Password" functionality, which says the calling application need to read the error code and redirect to PasswordReset Policy.
When I Inspected the html, I found a href for forgotpassword link which is pointing to my signUpSignIn Policy.
<div class="password-label">
<label for="password">Password</label>
<a id="forgotPassword" tabindex="2" href="/domain.onmicrosoft.com/B2C_1A_signup_signin/api/CombinedSigninAndSignup/forgotPassword?csrf_token=xxxxxx&StateProperties=xxx & p=B2C_1A_signup_signin">Forgot your password?</a>
</div>
Is there any way that I can call the PasswordReset policy from the href directly, instead of catching the error code, as I am using custom policies.
Thanks,
You can send the user directly to the password reset policy from your application.
You can't send the user directly from a Sign-In/Sing-Up policy to the Password Reset Policy as described here.
UserVoice: Go Direct to Password Reset from Sign-In/Sign-Up

Resources