diff options
Diffstat (limited to 'TwoStepsAuthenticator.TestWebsite')
-rw-r--r-- | TwoStepsAuthenticator.TestWebsite/Controllers/HomeController.cs | 7 | ||||
-rw-r--r-- | TwoStepsAuthenticator.TestWebsite/Users/WebsiteUser.cs | 1 |
2 files changed, 6 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"); } diff --git a/TwoStepsAuthenticator.TestWebsite/Users/WebsiteUser.cs b/TwoStepsAuthenticator.TestWebsite/Users/WebsiteUser.cs index 2cc6cc9..41f695a 100644 --- a/TwoStepsAuthenticator.TestWebsite/Users/WebsiteUser.cs +++ b/TwoStepsAuthenticator.TestWebsite/Users/WebsiteUser.cs @@ -26,4 +26,5 @@ namespace TwoStepsAuthenticator.TestWebsite.Users } } + }
\ No newline at end of file |