如何使字段验证在自定义策略自定义的ui上正常工作?

在Azure AD B2C中使用自定义策略,尝试通过添加自定义UI(我从头开始创建)并在HTML内添加id = api标记来更新UI,该UI可以正确反映,但输入默认情况下会显示错误消息,第一次加载时,如何使字段验证可作为默认UI?

 <ContentDefinitions>
      <ContentDefinition Id="api.signuporsignin">
        <LoadUri>https://XXXXX.blob.core.windows.net/templates/custom-ui.html</LoadUri>
        <RecoveryUri>~/common/default_page_error.html</RecoveryUri>
        <DataUri>urn:com:microsoft:aad:b2c:elements:unifiedssp:1.0.0</DataUri>
        <Metadata>
          <Item Key="DisplayName"></Item>
        </Metadata>
      </ContentDefinition>
 </ContentDefinitions>

如何使字段验证在自定义策略自定义的ui上正常工作?

zidaneii 回答:如何使字段验证在自定义策略自定义的ui上正常工作?

您可以实现CSS以显示和隐藏验证错误块。

通常是这样实现的:

.attrEntry .error.itemLevel,.attrEntry .helpText,.attrEntry .tiny {
  display: none!important;    }

您可以在github仓库中查看它以获取更多参考:

https://github.com/Azure-Samples/active-directory-external-identities-woodgrove-demo/blob/2b5110c25d1a626bf9b9ac27ecaaabad8b4bccf4/Templates/dist/unified_1.html

https://woodgrovegroceriesb2cdemo.azurewebsites.net/Account/LogIn

Azure AD B2C Custom UI error labels shown on first load

希望有帮助。

本文链接:https://www.f2er.com/3154644.html

大家都在问