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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.