Friday, 23 August 2013

Decrypting pass at login time failed using simpleCrypto Class

Decrypting pass at login time failed using simpleCrypto Class

I am decrypting password at the time of login.But Login failed because
crypto.Compute is generating new pass every time which is not equal to the
enrypted password that is stored in db. Here is my code. Controller
[HttpPost]
public ActionResult LogIn(Authentication log)
{
var crypto = new SimpleCrypto.PBKDF2();
Login ULogin = new Login();
if (ModelState.IsValid)
{
if
(ULogin.Validate(log.Email,crypto.Compute(log.Password)))
{
// FormsAuthentication.SetAuthCookie(log.Email,
log.RememberMe);
return RedirectToAction("Index", "Home");
}
}
else ModelState.AddModelError("", "Login failed..");
return View();
}

No comments:

Post a Comment