Created
January 4, 2017 18:39
-
-
Save AbubakarSiddiq/ce34b8852138d94627ee1f5b0bc86ac3 to your computer and use it in GitHub Desktop.
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
[HttpPost] | |
public ActionResult Login(LoginModel login) | |
{ | |
string message = ""; | |
bool status = false; | |
//check UserName and password form our database here | |
if (login.UserName == "Admin" && login.Password == "12345") // Admin as user name and 12345 as Password | |
{ | |
status = true; | |
message = "Two Factor Authentication Verification"; | |
Session["UserName"] = login.UserName; | |
//Two Factor Authentication Setup | |
TwoFactorAuthenticator TwoFacAuth = new TwoFactorAuthenticator(); | |
string UserUniqueKey = (login.UserName + key); | |
Session["UserUniqueKey"] = UserUniqueKey; | |
var setupInfo = TwoFacAuth.GenerateSetupCode("Dot Net Detail", login.UserName, UserUniqueKey, 300, 300); | |
ViewBag.BarcodeImageUrl = setupInfo.QrCodeSetupImageUrl; | |
ViewBag.SetupCode = setupInfo.ManualEntryKey; | |
} | |
else | |
{ | |
message = "Please Enter the Valid Credential!"; | |
} | |
ViewBag.Message = message; | |
ViewBag.Status = status; | |
return View(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment