This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// POST: /Account/Login | |
[HttpPost] | |
[AllowAnonymous] | |
[ValidateAntiForgeryToken] | |
public async Task<ActionResult> Login(LoginViewModel model, string returnUrl) | |
{ | |
if (ModelState.IsValid) | |
{ | |
var user = await UserManager.FindAsync(model.Email, model.Password); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@model MFAAuth.Models.RegisterViewModel | |
@{ | |
ViewBag.Title = "Register"; | |
} | |
<h2>@ViewBag.Title.</h2> | |
@using (Html.BeginForm("Register", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) | |
{ | |
@Html.AntiForgeryToken() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RegisterViewModel | |
{ | |
[Required] | |
[EmailAddress] | |
[Display(Name = "Email")] | |
public string Email { get; set; } | |
[Required] | |
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)] | |
[DataType(DataType.Password)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Security.Claims; | |
using System.Threading.Tasks; | |
using Microsoft.AspNet.Identity; | |
using Microsoft.AspNet.Identity.EntityFramework; | |
namespace MFAAuth.Models | |
{ | |
// You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more. | |
public class ApplicationUser : IdentityUser | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hello |
NewerOlder