【问题标题】:Azure B2C - Custom Policy - Custom UI - Change Password _ continue button disableAzure B2C - 自定义策略 - 自定义 UI - 更改密码 _ 继续按钮禁用
【发布时间】:2020-01-23 22:40:19
【问题描述】:

我已按照本教程“https://github.com/azure-ad-b2c/samples/tree/master/policies/embedded-password-reset”进行操作。一切运作良好。但是,当我尝试添加自定义 UI 页面以设置整个更改密码向导的样式时,电子邮件验证后“继续”按钮被禁用。我也找不到在更改密码工作流程中删除更改电子邮件按钮的方法。

我所做的唯一更改是添加自定义页面来样式更改密码页面。

<ContentDefinition Id="api.localaccountpasswordreset">
   <LoadUri>https://xxx.blob.core.windows.net/yyy/selfasserted.html</LoadUri>
   <Metadata>
      <Item Key="DisplayName">Local account change password page</Item>
   </Metadata>
</ContentDefinition>

自定义html页面

<!DOCTYPE html>
<html>
<head>
    <title>Test</title>
    <script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            // Remove the provided password reset link
            $("#forgotPassword").remove();

            // Move the new password reset button to the right position
            $("#PasswordResetUsingEmailAddressExchange").detach().appendTo("label[for='password']");

            // Set the style of the password reset button to look like a link
            $("#PasswordResetUsingEmailAddressExchange").attr("style",
                "background: none!important; color:#2872DD; border:none;  padding:0!important; font-size: .75em;  height: auto; width: auto;  margin-left: 5px");
        });
    </script>
</head>
<body>
    <div id="api"></div>
</body>
</html>

【问题讨论】:

  • 是否有特定的错误信息被抛出?
  • 您的 html 文件中可能存在一些冲突的 JavaScript 或 css。
  • @Nelles 没有 JS 错误
  • 我想我注意到有一次 ready() 不会告诉您 UI 内容已加载,因为它会在加载 HTML 后添加 UI 组件。因此,您可能需要进行某种形式的等待,以等待内容实际出现。
  • 嗨@Amal 请注意,Azure AD B2C 引用了特定版本的 jQuery。 You mustn't include a different version of it。否则这会导致问题。

标签: azure-ad-b2c


【解决方案1】:

The Azure AD B2C guidelines for use of JavaScript 表示您必须包含不同版本的 jQuery;否则,这会导致页面 UI 出现问题。

【讨论】:

    【解决方案2】:

    删除您的 jQuery 脚本标签。 Azure B2C 使用特定版本的 jQuery。添加另一个版本的 jQuery 可能会导致错误。您仍然可以在代码中使用 jQuery,但您不需要包含 jQuery 的脚本标记,因为它已经通过 azure API 加载。要更改 jQuery 的版本,您可以更新策略中的 DataUri。 enter link description here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-24
      相关资源
      最近更新 更多