Enabling two-factor authentication

Two-factor authentication can be enabled in an ASP.NET Core web application by uncommenting the following code that comes with the ASP.NET Core web application project template. You can use the same or equivalent logic when working with an empty project template. To store your phone number where the application will send the code to perform the second step of authentication can be done by uncommenting the following code snippet from the Index view page of ManageController.

Here is the code of Manage/Index.cshtml:

    @(Model.PhoneNumber ?? "None")     @if (Model.PhoneNumber != null)     {         <br />         <a asp-controller="Manage"         asp-action="AddPhoneNumber"        class="btn-bracketed">Change</a>  <form asp-controller="Manage" ...

Get Enterprise Application Architecture with .NET Core now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.