[英]How I can revert email confirmation in ASP.NET membership
I am using ASP.NET membership in my project and when ever user created I manually confirm his email address by this code: 我在项目中使用ASP.NET成员身份,并且每当用户创建时,我都会通过以下代码手动确认其电子邮件地址:
string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id.ToString());
await ConfirmEmail(user.Id.ToString(), code);
By this, users doesn't need to verify his login by using confirmation link sent to his email address , by the way this is project requirement. 这样,用户不需要使用发送到他的电子邮件地址的确认链接来验证他的登录名,这就是项目要求。
Now I want to revert this process by C# code. 现在,我想通过C#代码还原此过程。 I want to unconfirmed his email address, so how I can achieve this requirement?
我想不确定他的电子邮件地址,那么我怎样才能达到这一要求?
So, there is a "built in method", but it's not exposed on the UserManager
that you can access. 因此,有一个“内置方法”,但是您可以访问的
UserManager
上没有公开它。
The UserManager has an internal property Store
which inherits from IUserEmailStore
which has the methods used by the UserManager when you ask it to confirm an email address ( ConfirmEmailAsync
calls IUserEmailStore.SetEmailConfirmed
) and also when you check to see if an email is confirmed. UserManager具有一个内部属性
Store
,该属性继承自IUserEmailStore
,当用户要求它确认电子邮件地址( ConfirmEmailAsync
调用IUserEmailStore.SetEmailConfirmed
)以及检查是否确认电子邮件时,该属性具有UserManager所使用的方法。
The SetEmailConfirmed
method takes a Boolean parameter confirmed
which can therefore be set to true
or false
. 该
SetEmailConfirmed
方法采用布尔参数confirmed
其因此可以被设置为true
或false
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.