public ActionResult LogOn(LogOnModel model, string returnUrl) { if (ModelState.IsValid) { var user = _userRepository.GetByLoginPass(model.UserName, DataHashing.Compute(Algorithm.SHA1, model.Password)); if (user != null) { FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe); Usuario = user; if (!String.IsNullOrEmpty(returnUrl)) { return(Redirect(returnUrl)); } else { return(RedirectToAction("Index", "PostManager")); } } else { ModelState.AddModelError("", "Usuario y/o Clave Incorrecta."); } } // If we got this far, something failed, redisplay form return(View(model)); }
private void CompletionEntry() { ObjDataRegister.Password = DataHashing.GetDataHashing(ObjDataRegister.Password); ObjSourcePages.source = StartSourcePages = "Pages/PageMain.xaml"; string[] Result = InteractionPostgreSQL.AutoLogin(); ObjDataUser = (Result[0] != "") ? new DataUser { FirstName = Result[0], LastName = Result[1], Email = Result[2], Password = Result[3] } : new DataUser(); ObjDataRegister.FirstName = ObjDataRegister.LastName = ObjDataRegister.Email = ObjDataRegister.Password = ""; }
public ActionResult Create(User user) { if (!UserHelper.GetCurrent().IsAdmin) { return(View("AccesoDenegdo")); } if (ModelState.IsValid) { user.HashedPass = DataHashing.Compute(Algorithm.SHA1, user.HashedPass); _userRepository.Save(user); return(RedirectToAction("Index")); } else { return(View()); } }
private void CommandCheckLogIn() { ValidationDataImage(); if (ArrayAnalysis(ValidationDataCheck(false, false)) && InteractionPostgreSQL.SetActiveFieldEnter(ObjDataRegister.FirstName, DataHashing.GetDataHashing(ObjDataRegister.Password))) { CompletionEntry(); } }
private void CommandCheckSignUp() { ValidationDataImage(); if (ArrayAnalysis(ValidationDataCheck(false, false, false, false)) && InteractionPostgreSQL.AddWhereEnd(ObjDataRegister.FirstName, ObjDataRegister.LastName, ObjDataRegister.Email, DataHashing.GetDataHashing(ObjDataRegister.Password))) { CompletionEntry(); } }