private void UpdatePassword(SetupDefaultParametersViewModel setupDefaultParametersViewModel) { var randomCode = RandomStringGenerator.RandomString(); var userEntity = new UserEntity { UserID = 1, Password = PasswordHelper.GenerateHashedPassword(setupDefaultParametersViewModel.Password, randomCode), UserCode = TripleDES.EncryptString(randomCode) }; _userRepository.UpdateUser(userEntity); }
public ActionResult Index() { var installStatus = GetInstallStatus(); if (!installStatus) return RedirectToRoute("SetupIndex"); var setupDefaultParametersViewModel = new SetupDefaultParametersViewModel { AkismetUrl = GetRootUrl().TrimEnd('/') }; return View(setupDefaultParametersViewModel); }
public ActionResult Index(SetupDefaultParametersViewModel setupDefaultParametersViewModel) { if (ModelState.IsValid) { if (VerifyFields(setupDefaultParametersViewModel)) { UpdatePassword(setupDefaultParametersViewModel); UpdateSettings(setupDefaultParametersViewModel); // Installation is complete. Update the application variable HttpContext.Application["Installation_Status"] = "true"; return RedirectToAction("Index", "Home", new { Area = "" }); } } return View(setupDefaultParametersViewModel); }
private bool VerifyFields(SetupDefaultParametersViewModel setupDefaultParametersViewModel) { if (setupDefaultParametersViewModel.Password != setupDefaultParametersViewModel.ConfirmPassword) { ModelState.AddModelError("Password", "Passwords do not match"); return false; } return true; }
private void UpdateSettings(SetupDefaultParametersViewModel setupDefaultParametersViewModel) { _settingsRepository.BlogName = setupDefaultParametersViewModel.BlogName; _settingsRepository.BlogAkismetUrl = setupDefaultParametersViewModel.AkismetUrl; _settingsRepository.InstallationComplete = true; }