Cant customize the Verification code message - azure-ad-b2c

I’m helping a partner to customize their B2C policy to show a custom message for e-mail verification code. We tried to customize the following parameter on the TrustFrameworkExtension (Attached) but it had no effect:
<LocalizedString ElementType="UxElement"
StringId="ver_info_msg">Verification code has been sent to your inbox.
Please copy it to the input box below.</LocalizedString>\\
What we need to change is the display message for verification code, as shown on the image below:
Could anyone provide some guidance? I tried it different ways and I don´t know If we´re doing something wrong or if it´s a default message that can´t be customized. It´s impacting the partner go-live.

thanks for guidance! the message we were trying to customize has a different StringID. The correct StringID is verification_control_code_sent
Once we fixed it we resolved the issue:
<!--Local account sign-up page Portuguese-->
<LocalizedResources Id="api.localaccountsignup.pt">
<LocalizedStrings>
<LocalizedString ElementType="UxElement" StringId="verification_control_code_sent">Um código de segurança foi enviado para seu e-mail. Mantenha esta janela aberta.</LocalizedString>

The document shows:
The following are the IDs for a content definition with an ID of
api.localaccountsignup or any content definition that starts with
api.selfasserted, such as api.selfasserted.profileupdate and
api.localaccountpasswordreset.
So you need to make the change in the appropriate “api.xxx” action.
The sample extends Id api.localaccountsignup to api.localaccountsignup.en. And change the value of LocalizedString.
<Localization Enabled="true">
<SupportedLanguages DefaultLanguage="en" MergeBehavior="ReplaceAll">
<SupportedLanguage>en</SupportedLanguage>
</SupportedLanguages>
<LocalizedResources Id="api.localaccountsignup.en">
<LocalizedStrings>
<LocalizedString ElementType="UxElement" StringId="ver_fail_no_retry">Attempt limit exceeded - please check your email for the correct code</LocalizedString>
</LocalizedStrings>
</LocalizedResources>
</Localization>
Then you need to change value of ver_info_msg in JSON defaults for built-in policies. For more details, see here.
Navigate to Azure AD B2C -> User flows -> Languages(make sure Enable language customization) -> Configured

Related

How to dynamically display data in B2C sign up page with a localized String?

So I am trying to display a query parameter in my HTML page. I have not had an issue doing this is a claim, I created this.
<ClaimsSchema>
<ClaimType Id="ID">
<DisplayName>ID</DisplayName>
<DataType>string</DataType>
</ClaimType>
</ClaimsSchema>
Then in my relaying party I have this,
<OutputClaim ClaimTypeReferenceId="ID" AlwaysUseDefaultValue="true" DefaultValue="{OAUTH-KV:ID}" />
and in the sign in URL we have &ID=12345
What we are trying to do is send out sign up links with a specific ID value. Then when they make it to the sign in / sign up page the join now link has that ID appended to it.
So like www.mycompany.com/register/id=12345
I have localized the strings in self asserted page.
<Localization>
<LocalizedResources Id="api.selfasserted">
<LocalizedStrings>
<LocalizedString ElementType="UxElement" StringId="disclaimer_msg_intro">Dont have an account?</LocalizedString>
<LocalizedString ElementType="UxElement" StringId="disclaimer_link_1_text">Join Now</LocalizedString>
<LocalizedString ElementType="UxElement" StringId="disclaimer_link_1_url">http://www.mycompany.com/register/id=</LocalizedString>
</LocalizedStrings>
</LocalizedResources>
</Localization>
Is there a way to inject that claim in that link?
I know i can do this with JS... i am trying to avoid using Javascript.
It’s not possible to do dynamic claim resolving in localised elements function. You’re going to have to use JS.

Azure AD B2C Signup Page Customization

Currently Implementing a b2c signup flow via custom policies. Working on a usecase for b2c user registration page, when a user left the “required fields” as empty then the following error message is displayed as “This information is required” by default.
But how to customize to these mandatory field error message as “Name is required” or “Phone number is required” or “Telephone number is required”?
I haven’t found a right localization string ID to handle these mandatory field error message, Instead of a generic default error message. Any helpful suggestions?
I think you have to use localization to overwrite messages and texts.
<LocalizedResources Id="api.signuporsignin.en">
<LocalizedStrings>
<LocalizedString ElementType="ClaimType" ElementId="email" StringId="DisplayName">Email Address</LocalizedString>
<LocalizedString ElementType="UxElement" StringId="heading">Sign in</LocalizedString>
<LocalizedString ElementType="UxElement" StringId="social_intro">Sign in with your social account</LocalizedString>
<LocalizedString ElementType="UxElement" StringId="local_intro_generic">Sign in with your {0}</LocalizedString>
<LocalizedString ElementType="UxElement" StringId="requiredField_password">Please enter your password</LocalizedString>
<LocalizedString ElementType="UxElement" StringId="requiredField_generic">Please enter your {0}</LocalizedString>
<LocalizedString ElementType="UxElement" StringId="invalid_generic">Please enter a valid {0}</LocalizedString>
<LocalizedString ElementType="UxElement" StringId="createaccount_one_link">Sign up now</LocalizedString>
<LocalizedString ElementType="UxElement" StringId="createaccount_two_links">Sign up with {0} or {1}</LocalizedString>
<LocalizedString ElementType="UxElement" StringId="createaccount_three_links">Sign up with {0}, {1}, or {2}</LocalizedString>
<LocalizedString ElementType="UxElement" StringId="forgotpassword_link">Forgot your password?</LocalizedString>
<LocalizedString ElementType="UxElement" StringId="button_signin">Sign in</LocalizedString>
<LocalizedString ElementType="UxElement" StringId="divider_title">OR</LocalizedString>
<LocalizedString ElementType="UxElement" StringId="unknown_error">We are having trouble signing you in. Please try again later.</LocalizedString>
<!-- Uncomment the remember_me only if the keep me signed in is activated.
<LocalizedString ElementType="UxElement" StringId="remember_me">Keep me signed in</LocalizedString> -->
<LocalizedString ElementType="ClaimsProvider" StringId="FacebookExchange">Facebook</LocalizedString>
<LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfInvalidPassword">Your password is incorrect.</LocalizedString>
<LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfPasswordExpired">Your password has expired.</LocalizedString>
<LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfClaimsPrincipalDoesNotExist">We can't seem to find your account.</LocalizedString>
<LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfOldPasswordUsed">Looks like you used an old password.</LocalizedString>
<LocalizedString ElementType="ErrorMessage" StringId="DefaultMessage">Invalid username or password.</LocalizedString>
<LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfUserAccountDisabled">Your account has been locked. Contact your support person to unlock it, then try again.</LocalizedString>
<LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfUserAccountLocked">Your account is temporarily locked to prevent unauthorized use. Try again later.</LocalizedString>
<LocalizedString ElementType="ErrorMessage" StringId="AADRequestsThrottled">There are too many requests at this moment. Please wait for some time and try again.</LocalizedString>
</LocalizedStrings>
</LocalizedResources>
The specific string ID will vary depending on the claim. Use Customize Language guidance via XML policy to edit Localization element for the localized string.
See page layout version for your specific ID (if you require a version update).
I noticed in the example you posted, you had "UserMessageIfMissingRequiredElemnt" rather than "UserMessageIfMissingRequiredElement" (yours is missing that final "e"), this is perhaps why the localization didn't work

Remove text from B2C custom policy sign up flow

In the sign up page, when the existing user tries to sign up, it gives an error, this user already exists. But it shows the text, ''confirmed email address'' , how can we remove the text?
when you create custom policy you should be able to define this message in Localization part of the policy.
Example of this file is here:
https://github.com/Azure-Samples/active-directory-b2c-custom-policy-starterpack/blob/main/Display%20Controls%20Starterpack/LocalAccounts/TrustFrameworkLocalization.xml
<!-- Generic errors -->
<LocalizedString ElementType="ErrorMessage" StringId="ServiceThrottled">There are too many requests at this moment. Please wait for some time and try again.</LocalizedString>
<LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfClaimNotVerified">Claim not verified: {0}</LocalizedString>
<LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfClaimsPrincipalAlreadyExists">A user with the specified ID already exists. Please choose a different one.</LocalizedString>
<LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfIncorrectPattern">Incorrect pattern for: {0}</LocalizedString>
<LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfInvalidInput">{0} has invalid input.</LocalizedString>
<LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfMissingRequiredElement">Missing required element: {0}</LocalizedString>
<LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfValidationError">Error in validation by: {0}</LocalizedString>

Azure AD B2C Self-service password reset showing wrong title

When enabling this new self service password reset, it shows wrong titles on the login page.
https://learn.microsoft.com/en-us/azure/active-directory-b2c/add-password-reset-policy?pivots=b2c-custom-policy#self-service-password-reset-recommended
It shows these:
Sign in with your social account
OR
Sign in with your sign in name
But I'm not using any social account, only local account, the Sign in with your social account is empty.
I also tried on this sample, removing facebook as social account, having only local account, however it keeps the empty Sign in with your social account.
https://github.com/azure-ad-b2c/samples/tree/master/policies/embedded-password-reset
Anyone managed to enable self service password reset for local account only and having the correct title Sign in with your sign in name?
This has been fixed in newest version of content definition. In TrustFrameworkBase file use for api.signuporsignin the following DataUri:
<DataUri>urn:com:microsoft:aad:b2c:elements:contract:unifiedssp:2.1.5</DataUri>
There are two ways to approach this:
Using the Localization features of the Identity Experience Framework. This will allow you to modify the UxElements on your Content Definitions. More information can be found at https://learn.microsoft.com/en-us/azure/active-directory-b2c/localization.
Completely customize the User Interface - https://learn.microsoft.com/en-us/azure/active-directory-b2c/customize-ui-with-html?pivots=b2c-custom-policy
It took me a minute to test this on one of my policies, but this is what I added to my Sign In/Sign Up page to verify the localization.
<BuildingBlocks>
<Localization Enabled="true">
<SupportedLanguages DefaultLanguage="en" MergeBehavior="ReplaceAll">
<SupportedLanguage>en</SupportedLanguage>
</SupportedLanguages>
<LocalizedResources Id="api.selfasserted.en">
<LocalizedStrings>
<LocalizedString ElementType="UxElement" StringId="local_intro_generic">Brad</LocalizedString>
</LocalizedStrings>
</LocalizedResources>
</Localization>
</BuildingBlocks>
And then updated my Content Definition:
<ContentDefinition Id="api.selfasserted">
<LoadUri>~/tenant/templates/AzureBlue/selfAsserted.cshtml</LoadUri>
<RecoveryUri>~/common/default_page_error.html</RecoveryUri>
<DataUri>urn:com:microsoft:aad:b2c:elements:contract:selfasserted:2.1.2</DataUri>
<Metadata>
<Item Key="DisplayName">Collect information from user page</Item>
</Metadata>
<LocalizedResourcesReferences>
<LocalizedResourcesReference Language="en" LocalizedResourcesReferenceId="api.selfasserted.en"/>
</LocalizedResourcesReferences>
</ContentDefinition>

Localizing the API response in Custom Police Azure ADB2C

I have implemented localization in Azure ADB2C custom policy.
<ClaimType Id="signInName">
<DisplayName>Please enter your email</DisplayName>
<DataType>string</DataType>
<UserHelpText>Enter your email address to signin</UserHelpText>
<Restriction>
<Pattern RegularExpression="^[a-zA-Z0-9_.+-]+#[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$"/>
</Restriction>
</ClaimType>
<Localization Enabled="true">
<SupportedLanguages DefaultLanguage="en" MergeBehavior="ReplaceAll">
<SupportedLanguage>en</SupportedLanguage>
<SupportedLanguage>es</SupportedLanguage>
</SupportedLanguages>
<LocalizedResources Id="en">
<LocalizedStrings>
<LocalizedString ElementType="ClaimType" ElementId="signInName" StringId="DisplayName">Please enter your email</LocalizedString>
<LocalizedString ElementType="ClaimType" ElementId="signInName" StringId="UserHelpText">Enter your email address to signin</LocalizedString>
</LocalizedStrings>
</LocalizedResources>
<LocalizedResources Id="es">
<LocalizedStrings>
<LocalizedString ElementType="ClaimType" ElementId="signInName" StringId="DisplayName">Por favor introduzca su correo electrónico</LocalizedString>
<LocalizedString ElementType="ClaimType" ElementId="signInName" StringId="UserHelpText">Ingrese su dirección de correo electrónico para iniciar sesión</LocalizedString>
</LocalizedStrings>
</LocalizedResources>
</Localization>
Everything is working as expected but when the login button is clicked, an API call is made and the response is always in English. Also the query string parameter to indicate the language is not sent in the API call. Any help is greatly appreciated.
You need to first find what is the string ID which is showing this error.
We support these IDs for localization which you might have customized in your policies.
Then, once you know which ID is being used for your error message, you can add a LocalizedString element like below (For example, I am assuming the ElementType is ErrorMessage and StringID is DefaultMessage):
<LocalizedString ElementType="ErrorMessage" StringId="DefaultMessage">#Invalid username or password.</LocalizedString>
You can find out different examples of the same here: https://learn.microsoft.com/en-us/azure/active-directory-b2c/custom-policy-localization

Resources