Search code examples
azure-ad-b2cazure-ad-b2c-custom-policy

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?


Solution

  • 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>