Azure AD B2C自定义密码重置策略无法使用+ char \ sign验证电子邮件 [英] Azure AD B2C custom Password reset policy won't validate e-mail with + char\sign
问题描述
用户可以使用Azure AD B2C进行注册,并且可以使用包含+
的电子邮件进行登录.但是,当单击登录页面上的忘记密码"链接并使用+
字符输入其电子邮件时,将显示以下错误:
The user could signup and can sign in just fine using Azure AD B2C with an email that contains +
. However, when clicking "Forgot password" link on the sign-in page and entering their e-mail with a +
char the following error is displayed:
我在Azure的反馈网站上看到了2个相关问题:
I saw 2 related issues on Azure's feedback site:
允许加号登录电子邮件地址 [用户 Naud van Onna 发表了一条与此问题匹配的评论. ]
allow plus sign in email addresses [ there's a comment by user Naud van Onna that matches this question. ]
我看到在电子邮件地址中使用"+"号成功注册了 也一样不幸的是,密码重置功能不起作用 使用带有"+"符号的电子邮件地址.
I've seen a successful sign-up using a '+' symbol in the email address as well. Unfortunately the password reset functionality is not working using an email address with a '+' symbol.
和
Support plus-addressing in emails, which is invaluable for testing [ in this one it's mentioned e-mail sub-addressing
feature which describes our situation. We use the +
e-mail addresses to test our application. ]
自定义策略.xml
文件中是否有任何地方可以输入自定义正则表达式来验证此电子邮件地址并允许使用+
标记?
Is there any place in the custom policies .xml
files where I can enter a custom regex to validate this e-mail address and allow the +
sign?
我在TrustFrameworkBase.xml
文件中看到了<TechnicalProfile Id="LocalAccountDiscoveryUsingEmailAddress">
,但不确定在哪里进行修改...
I saw <TechnicalProfile Id="LocalAccountDiscoveryUsingEmailAddress">
in TrustFrameworkBase.xml
file but I'm not sure where to modify it...
<!-- 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">
.
.
.
推荐答案
好吧...经过更多研究,我发现了错误消息"请输入有效的电子邮件地址."在TrustFrameworkBase.xml
内的电子邮件ClaimType
中.
Well... after a little bit more research I found the error message "Please enter a valid e-mail address." in the email ClaimType
inside 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-]+)*$
是用于验证电子邮件的人...我们只需要对其进行一周处理,以使其接受如下所示的+
符号:
is the one that validates the email... we just need to tweek it so that it accepts the +
sign like this:
^ [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文档.
Microsoft doc about ClaimsSchema.
这篇关于Azure AD B2C自定义密码重置策略无法使用+ char \ sign验证电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!