diff options
author | Christoph Enzmann <christoph.enzmann@confer.ch> | 2013-12-05 11:19:11 +0100 |
---|---|---|
committer | Christoph Enzmann <christoph.enzmann@confer.ch> | 2013-12-05 11:19:11 +0100 |
commit | b52682a9b3216a7d966238e3c8ed6b4da3920313 (patch) | |
tree | 9cd5e32a7dd65b1297dfe9655173f3a0c512be05 /TwoStepsAuthenticator.TestWebsite | |
parent | 99c53801f3d4269b8058e87fa48b4bc37c7533fd (diff) | |
download | TwoStepsAuthenticator-b52682a9b3216a7d966238e3c8ed6b4da3920313.zip TwoStepsAuthenticator-b52682a9b3216a7d966238e3c8ed6b4da3920313.tar.gz TwoStepsAuthenticator-b52682a9b3216a7d966238e3c8ed6b4da3920313.tar.bz2 |
Counter based OTP added, removed UsedCodesManager from authenticator, UsedCodesManager refactoring
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 |