You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在B2C自定义策略中,如何在InputClaim文本框上方添加提示信息?

实现方法

要在用户名输入框上方添加「请输入您的用户名」提示,可通过修改ClaimType的配置实现,以下是两种可行方案:

方案1:局部修改当前TechnicalProfile(推荐)

直接在目标TechnicalProfile中重定义signInName字段的属性,仅对密码重置页面生效,不影响其他流程:

<TechnicalProfile Id="SelfAsserted-LocalAccountLookup-Combined-PwdReset">
    <!-- 新增ClaimsSchema节点,重定义signInName的提示信息 -->
    <ClaimsSchema>
        <ClaimType Id="signInName">
            <DisplayName>用户名</DisplayName>
            <HelpText>请输入您的用户名</HelpText>
            <DataType>string</DataType>
            <UserInputType>TextBox</UserInputType>
        </ClaimType>
    </ClaimsSchema>
    <OutputClaims>
        <OutputClaim ClaimTypeReferenceId="signInName" Required="true" />
        <OutputClaim ClaimTypeReferenceId="isEmailBoolean" />
        <OutputClaim ClaimTypeReferenceId="objectId" />
    </OutputClaims>
    <ValidationTechnicalProfiles>
        <ValidationTechnicalProfile ReferenceId="AAD-UserReadUsingIdentifier" />
        <ValidationTechnicalProfile ReferenceId="regexAnalysisUsername" />
    </ValidationTechnicalProfiles>
    <IncludeTechnicalProfile
        ReferenceId="SelfAsserted-LocalAccountLookup-Combined-SignUp" />
    <UseTechnicalProfileForSessionManagement ReferenceId="SM-AAD" />
</TechnicalProfile>

方案2:全局修改ClaimType定义

如果希望所有使用signInName字段的页面都显示该提示,可在TrustFramework的ClaimsSchema中修改全局配置(通常在TrustFrameworkExtensions.xml文件中):

<ClaimsSchema>
    <ClaimType Id="signInName">
        <DisplayName>用户名</DisplayName>
        <!-- 添加该行设置输入框上方提示 -->
        <HelpText>请输入您的用户名</HelpText>
        <DataType>string</DataType>
        <UserInputType>TextBox</UserInputType>
    </ClaimType>
    <!-- 其他ClaimType定义 -->
</ClaimsSchema>

说明

  • HelpText属性的内容会根据UI主题布局,在输入框附近(通常为上方)作为提示信息展示
  • 若使用自定义UI模板,需确保模板支持渲染HelpText内容,否则需调整模板代码匹配该属性

内容的提问来源于stack exchange,提问作者KevinG

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 11:38:23