Azure AD B2C 注册页面自定义

问题描述 投票:0回答:3

当前通过自定义策略实施 B2C 注册流程。在 B2C 用户注册页面的用例中工作,当用户将“必填字段”留空时,默认情况下以下错误消息将显示为“此信息为必填项”。

但是如何将这些必填字段错误消息自定义为“姓名为必填项”或“电话号码为必填项”或“电话号码为必填项”?

我还没有找到正确的本地化字符串 ID 来处理这些必填字段错误消息,而不是通用的默认错误消息。有什么有用的建议吗?

azure-ad-b2c azure-ad-b2c-custom-policy
3个回答
0
投票

我认为你必须使用本地化来覆盖消息和文本。

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

0
投票

具体字符串 ID 会根据声明的不同而有所不同。使用 通过 XML 策略自定义语言指南来编辑本地化字符串的 Localization 元素。

请参阅页面您的特定 ID 的布局版本(如果您需要版本更新)。


0
投票

我注意到在您发布的示例中,您有“UserMessageIfMissingRequiredElemnt”而不是“UserMessageIfMissingRequiredElement”(您的缺少最后的“e”),这也许就是本地化不起作用的原因

© www.soinside.com 2019 - 2024. All rights reserved.