CombinedSignInSignUp步骤中的模式消息配置不正确

时间:2017-11-02 14:46:56

标签: azure-ad-b2c

使用为该字段定义的无效模式在width: 100%旅程步骤输入密码会导致在表单的输入部分上方显示以下错误消息:

  

[密码]

的模式不正确

有没有办法配置此错误消息,以使其更加用户友好?

2 个答案:

答案 0 :(得分:2)

Yes but that message can be used for multiple fields.

See this guide: Azure Active Directory B2C: Using language customization.


  1. Download the current content:

    download langauge customization content

  2. Edit the json and re-upload it:

    {
        "ElementType": "ErrorMessage",
        "ElementId": null,
        "StringId": "UserMessageIfIncorrectPattern",
        "Value": "Incorrect pattern for: {0}"
    }
    

答案 1 :(得分:2)

感谢spottedmahn提供有关语言自定义的信息。当我使用自定义B2C策略时,我无法通过Azure门户编辑语言功能。

我发现WingTipGames示例中的this policy显示了如何实现我想要的目标。

我在ContentDefinition中添加了LocalizedResourceReference,如下所示:

<ContentDefinition Id="api.combinedsignupsignin">
    <LoadUri>https://www.mywebsite.net/login</LoadUri>
    <RecoveryUri>~/common/default_page_error.html</RecoveryUri>
    <DataUri>urn:com:microsoft:aad:b2c:elements:unifiedssp:1.1.0</DataUri>
    <Metadata>
      <Item Key="DisplayName">Signin and Signup</Item>
    </Metadata>
    <LocalizedResourcesReferences MergeBehavior="Prepend">
      <LocalizedResourcesReference Language="en" Url="https://mywebsite.net" LocalizedResourcesReferenceId="api.combinedsignupsignin.en" />
    </LocalizedResourcesReferences>
  </ContentDefinition>

然后我在BuildingBlocks中添加了以下Localization部分:

<Localization Enabled="true">
  <SupportedLanguages DefaultLanguage="en" MergeBehavior="ReplaceAll">
    <SupportedLanguage>en</SupportedLanguage>
  </SupportedLanguages>
  <LocalizedResources Id="api.combinedsignupsignin.en">
    <LocalizedStrings>
      <LocalizedString ElementType="ErrorMessage" StringId="UserMessageIfIncorrectPattern">Please enter a valid password</LocalizedString>
    </LocalizedStrings>
  </LocalizedResources>
</Localization>

这导致我在屏幕上收到所需的错误消息:

&#34;请输入有效密码&#34;