diff options
Diffstat (limited to 'TwoStepsAuthenticator.TestWebsite/Controllers/HomeController.cs')
-rw-r--r-- | TwoStepsAuthenticator.TestWebsite/Controllers/HomeController.cs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/TwoStepsAuthenticator.TestWebsite/Controllers/HomeController.cs b/TwoStepsAuthenticator.TestWebsite/Controllers/HomeController.cs index c926019..ead9168 100644 --- a/TwoStepsAuthenticator.TestWebsite/Controllers/HomeController.cs +++ b/TwoStepsAuthenticator.TestWebsite/Controllers/HomeController.cs @@ -13,6 +13,8 @@ namespace TwoStepsAuthenticator.TestWebsite.Controllers // // GET: /Home/ + private static readonly UsedCodesManager usedCodesManager = new UsedCodesManager(); + public ActionResult Index() { return View(); @@ -42,9 +44,10 @@ namespace TwoStepsAuthenticator.TestWebsite.Controllers public ActionResult DoubleAuth(string code) { WebsiteUser user = (WebsiteUser)Session["AuthenticatedUser"]; - var auth = new TwoStepsAuthenticator.Authenticator(); - if (auth.CheckCode(user.DoubleAuthKey, code)) + var auth = new TwoStepsAuthenticator.TimeAuthenticator(); + if (auth.CheckCode(user.DoubleAuthKey, code) && usedCodesManager.IsCodeUsed(user.DoubleAuthKey, code)) { + usedCodesManager.AddCode(user.DoubleAuthKey, code); FormsAuthentication.SetAuthCookie(user.Login, true); return RedirectToAction("Welcome"); } |