用户可以使用Azure AD B2C进行注册,并且可以通过包含+
的电子邮件进行登录。但是,单击登录页面上的“忘记密码”链接并输入带有+
字符的电子邮件时,将显示以下错误:
我在Azure的反馈网站上看到了2个相关问题:
allow plus sign in email addresses [用户 Naud van Onna 的一条评论与此问题相匹配。 ]
我看到在电子邮件地址中使用“ +”号成功注册 也一样不幸的是,密码重置功能不起作用 使用带有“ +”符号的电子邮件地址。
和
Support plus-addressing in emails, which is invaluable for testing [在这一部分中,提到了电子邮件sub-addressing
功能,它描述了我们的情况。我们使用+
电子邮件地址来测试我们的应用程序。 ]
自定义策略.xml
文件中是否有任何地方可以输入自定义正则表达式来验证此电子邮件地址并允许使用+
符号?
我在<TechnicalProfile Id="LocalAccountDiscoveryUsingEmailAddress">
文件中看到了TrustFrameworkBase.xml
,但不确定在哪里进行修改...
<!-- This technical profile forces the user to verify the email address that they provide on the UI. Only after email is verified, the user account is
read from the directory. -->
<TechnicalProfile Id="LocalAccountDiscoveryUsingEmailAddress">
.
.
.
答案 0 :(得分:0)
好吧...经过更多研究,我在ClaimType
内的电子邮件TrustFrameworkBase.xml
中发现了错误消息“ 请输入有效的电子邮件地址。”。
<ClaimType Id="email">
<DisplayName>Email Address</DisplayName>
<DataType>string</DataType>
<DefaultPartnerClaimTypes>
<Protocol Name="OpenIdConnect"
PartnerClaimType="email" />
</DefaultPartnerClaimTypes>
<UserHelpText>Email address that can be used to contact you.</UserHelpText>
<UserInputType>TextBox</UserInputType>
<Restriction>
<Pattern RegularExpression="^[a-zA-Z0-9.!#$%&'^_`{}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$"
HelpText="Please enter a valid email address." />
</Restriction>
</ClaimType>
此正则表达式
^ [a-zA-Z0-9。!#$%&'^ _`{}〜-] + @ [a-zA-Z0-9-] +(?:。[a-zA-Z0 -9-] +)* $
是用于验证电子邮件的人……我们只需要对其进行周整,以使其接受+
标记,如下所示:
^ [a-zA-Z0-9。+!#$%&'^ _`{}〜-] + @ [a-zA-Z0-9-] +(?:。[a-zA- Z0-9-] +)* $
有关ClaimsSchema的Microsoft文档。