Len*_*rri -1 regex email-validation forgot-password reset-password azure-ad-b2c
用户可以使用 Azure AD B2C 以及包含+
. 但是,当单击登录页面上的“忘记密码”链接并输入带有字符的电子邮件时,+
会显示以下错误:
我在 Azure 的反馈网站上看到了 2 个相关问题:
允许加号登录电子邮件地址[ 用户Naud van Onna有一条评论与此问题匹配。]
我也看到在电子邮件地址中使用“+”符号成功注册。不幸的是,使用带有“+”符号的电子邮件地址时,密码重置功能无法正常工作。
和
支持电子邮件中的加地址,这对于测试非常有价值[在这一篇中提到了描述我们情况的电子邮件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">
.
.
.
Run Code Online (Sandbox Code Playgroud)
嗯...经过更多研究后,我在电子邮件内发现了错误消息“请输入有效的电子邮件地址。 ” 。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>
Run Code Online (Sandbox Code Playgroud)
这个正则表达式
^[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 文档。