简体   繁体   English

使用 MVC 5 和 Asp.net Identity 进行电子邮件确认

[英]Email Confirmation with MVC 5 and Asp.net Identity

I have been searching, but have not found any documentation on how to implement Email confirmation with MVC 5 using the new ASP.net Identity.我一直在搜索,但没有找到任何关于如何使用新的 ASP.net 标识通过 MVC 5 实现电子邮件确认的文档。 There does not seem to be any documentation on this topic (that I could find).似乎没有关于这个主题的任何文档(我可以找到)。

Has anyone solved this yet?有没有人解决过这个问题? I am very surprised that this is not included by default in the default MVC 5 project.我很惊讶这在默认的 MVC 5 项目中没有默认包含。

Any guidance is greatly appreciated.非常感谢任何指导。

Thank You谢谢你

I have written a step-by-step article on how to add email confirmation when using ASP.NET Identity .我写了一篇关于如何在使用 ASP.NET Identity 时添加电子邮件确认的分步文章 You can get the source code here in the project folder AspNetIdentity\\AspNetIdentityRefApp .您可以在项目文件夹AspNetIdentity\\AspNetIdentityRefApp 中获取源代码 I have also created a service layer that encapsulates ASP.NET Identity, making it easier to incorporate in new MVC 5 applications and mimics the WebSecurity API used by SimpleMembership.我还创建了一个封装 ASP.NET Identity 的服务层,使其更容易集成到新的 MVC 5 应用程序中,并模仿 SimpleMembership 使用的 WebSecurity API。 You can get that class library from AspNetIdentity\\SimpleSecurity.AspNetIdentity There is also reference app for using this library in AspNetIdentity\\SimpleSecurity.AspNetIdentity.RefApp .你可以从AspNetIdentity \\ SimpleSecurity.AspNetIdentity该类库也有参考应用程序的使用AspNetIdentity \\ SimpleSecurity.AspNetIdentity.RefApp这个库。 The class library and reference app also show how to implement password reset using a token and basic authentication on Web API's.类库和参考应用程序还展示了如何在 Web API 上使用令牌和基本身份验证来实现密码重置。

For ASP MVC 5 you can now try the pre-release of Identity 2 which has email confirmation and password reset...对于 ASP MVC 5,您现在可以尝试预发布的 Identity 2,它具有电子邮件确认和密码重置...

https://devblogs.microsoft.com/aspnet/announcing-preview-of-microsoft-aspnet-identity-2-0-0-alpha1/ https://devblogs.microsoft.com/aspnet/annoucing-preview-of-microsoft-aspnet-identity-2-0-0-alpha1/

I installed identity framework 2 in an MVC website in May 2016, and it includes email confirmation, although it's commented out initially.我于 2016 年 5 月在 MVC 网站中安装了身份框架 2,它包括电子邮件确认,尽管最初已被注释掉。 Here's what to look for in the account controller:以下是要在帐户控制器中查找的内容:

在此处输入图片说明

So when a user registers, you can uncomment the code to send them an email.因此,当用户注册时,您可以取消注释代码以向他们发送电子邮件。 If you've got a good understanding of the MVC model, the rest should be relatively straightforward.如果您对 MVC 模型有很好的理解,其余的应该相对简单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM