public ActionResult SignIn(Person model) { //if (ModelState.IsValid) //{ loginRepo = new LoginRepository(); Bus.Person personModel = new Bus.Person(); personModel.UserId = model.UserId; personModel.PasswordHash = Encryptor.MD5Hash(model.PasswordHash); bool isValid = loginRepo.Validate(personModel); if (isValid) { FormsAuthentication.SetAuthCookie(model.UserId, true); return(RedirectToAction("Dashboard", new { query = model.UserId })); } ViewBag.Error = "Invalid Username or Password"; //} return(View("Login", model)); }
public ActionResult SignUp(Person model) { if (ModelState.IsValid) { loginRepo = new LoginRepository(); Bus.Person personModel = new Bus.Person(); personModel.UserId = model.UserId; personModel.PasswordHash = Encryptor.MD5Hash(model.PasswordHash); personModel.FullName = model.FullName; personModel.Email = model.Email; var result = loginRepo.SignUp(personModel); if (result == "Success") { ViewBag.Message = "Congratulations!You have successfully registered with Twitter Clone!"; } else if (result == "Duplicate User") { ViewBag.Error = "There is already an existing user with the same Username/Email ID."; } } return(View(model)); }