public IActionResult Index() { this.ViewBag.Title = SessionContext.GetCurrentVaultName(); this.ViewBag.SubTitle = StringResources.VaultExplorer; var test = this.User.Identity.IsAuthenticated; return(View()); }
public IActionResult Rename(VaultRenameViewModel model) { SyncContext.Lock(); try { using (var masterPassword = SessionContext.GetMasterPassword()) { if (ModelState.IsValid) { var vaultRepository = VaultRepositoryFactory.CreateInstance(); if (vaultRepository.VaultExists(model.NewVaultName)) { ModelState.AddModelError(nameof(model.NewVaultName), StringResources.VaultNameAlreadyExists); return(View(model)); } var currentVaultName = SessionContext.GetCurrentVaultName(); var vault = vaultRepository.GetVault(currentVaultName, masterPassword); vault.Name = model.NewVaultName; vaultRepository.SaveVault(vault, masterPassword); vaultRepository.DeleteVault(currentVaultName); SessionContext.SetCurrentVaultName(model.NewVaultName); return(RedirectToAction("Index", "VaultExplorer")); } else { return(View(model)); } } } finally { SyncContext.Release(); } }