Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string PasswordSalt = Crypto.HashPassword(DateTime.Now.ToString());
- string hashPassword = Crypto.HashPassword(formcollection["PassWord"]); //Hash User PassWord
- user.PassWord = Crypto.HashPassword(PasswordSalt + hashPassword);//Add Salt to Password For Futher Security
- user.PassWordSalt = PasswordSalt;
- Users ThisUser = Users.UsersGetByEmail((string)Session["email"]);
- string checkpassword = ThisUser.PassWord;
- //User Inputed password.
- string password = user.PassWord;
- if (password != null)
- {
- //Need to fix.
- string encrypt_password = Crypto.HashPassword(password);
- string salted_password = Crypto.HashPassword(ThisUser.PassWordSalt + encrypt_password);
- //bool does_password_match = Crypto.VerifyHashedPassword(checkpassword, password);
- if (checkpassword == salted_password)
- {
- //Check if the inputed password matches the password from the Database.
- //Remember to give session based on the user_id.
- Session["user_id"] = ThisUser.Id;
- return RedirectToAction("Promise");
- }
- else
- {
- ModelState.AddModelError("PassWord", "Wrong Password, Please Enter Correct Password");
- return View(user);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement