void ReleaseDesignerOutlets() { if (GeneratedPassword != null) { GeneratedPassword.Dispose(); GeneratedPassword = null; } if (MasterKey != null) { MasterKey.Dispose(); MasterKey = null; } if (SitesTable != null) { SitesTable.Dispose(); SitesTable = null; } if (UserName != null) { UserName.Dispose(); UserName = null; } }
public void Reset() { UserName.Value = null; Sites.Clear(); GeneratedPassword.SetValue(string.Empty); GeneratedForSite.SetValue(string.Empty); // Notify Window to reset the entered passwd ResetMasterPassword.SetValue(true); }
private void DoGeneratePassword() { var selectedEntry = SelectedItem.Value; string pw = new System.Net.NetworkCredential(string.Empty, CurrentMasterPassword.Value).Password; var masterkey = Algorithm.CalcMasterKey(UserName.Value, pw); var templateSeed = Algorithm.CalcTemplateSeed(masterkey, selectedEntry.SiteName.Value, selectedEntry.Counter.Value); GeneratedPassword.SetValue(Algorithm.CalcPassword(templateSeed, selectedEntry.TypeOfPassword.Value)); GeneratedForSite.SetValue(selectedEntry.SiteName.Value); }
public ActionResult GeneratePassword(PasswordGeneration passwordGeneration) { var generatedPassword = new GeneratedPassword { Value = passwordGenerator.GeneratePassword(passwordGeneration.DomainName, passwordGeneration.MasterPassword, passwordGeneration.PasswordLength, passwordGeneration.HashFunction, passwordGeneration.CharacterSpace) }; return(Json(generatedPassword)); }
public ActionResult Create(UserSaveViewModel model) { model.departmentList = _entities.acq_department_master.ToList(); model.SectionMasterList = _entities.acq_section_master.ToList(); if (ModelState.IsValid) { try { string GenPwd1 = model.Password; string GetSalt = GeneratedPassword.CreateSalt(10); string hashString = GeneratedPassword.GenarateHash(GenPwd1, GetSalt); tbl_tbl_User obj = new tbl_tbl_User(); obj.UserName = model.UserName; obj.InternalEmailID = model.InternalEmailID; obj.ExternalEmailID = model.ExternalEmailID; obj.Password = null; obj.RankUser = model.RankUser; obj.Phone = model.Phone; obj.DepartmentID = model.DepartmentID; obj.SectionID = model.SectionID; obj.ValidFrom = Convert.ToDateTime(model.ValidFrom); obj.ValidTill = Convert.ToDateTime(model.ValidTill); obj.IPAddress = model.IPAddress; obj.MacAddress = model.MacAddress; obj.Designation = model.Designation; obj.LoginAllowed = model.LoginAllowed; obj.Pswd_Salt = Encryption.Encrypt(GenPwd1); obj.Flag = "Y"; obj.LoginCount = 0; obj.CreatedBy = Convert.ToInt32(Session["UserID"]); obj.CreatedOn = System.DateTime.Now; obj.IsDeleted = false; _entities.tbl_tbl_User.Add(obj); _entities.SaveChanges(); return(RedirectToAction("Index")); } catch (Exception ex) { throw ex; } } return(View(model)); }
public async Task CopyClicked() { try { if (GeneratedPassword.IsNullOrEmpty()) { throw new NullReferenceException("No password to copy"); } await Clipboard.WriteTextAsync(GeneratedPassword); UiSuccess("Password copied"); } catch (Exception ex) { UiError($"Can not copy password: {ex.Message}"); } }
public async Task Execute(GenerateNewPasswordMessage message) { var foundUser = await this._dataAccess.GetUserByEmail(new Email(message.Email)); if (foundUser == null) { throw new Error.UserNotFound(); } var newPassword = new AutomaticGeneratedPassword(); foundUser.ChangePassword(new Sha1EncryptedPassword(newPassword)); await this._dataAccess.Persist(); var generatedPassword = new GeneratedPassword(foundUser.Name.Value, foundUser.Email.Value, newPassword.Value); await this._eventBus.Publish(new Event("NewPasswordGenerated", nameof(GenerateNewPassword), generatedPassword)); }
// [Route("UUpdate")] public ActionResult Update(UserSaveViewModel model) { string GenPwd1 = model.Password; string GetSalt = GeneratedPassword.CreateSalt(10); string hashString = GeneratedPassword.GenarateHash(GenPwd1, GetSalt); try { var _updateUser = _entities.tbl_tbl_User.Where(x => x.UserId == model.UserId).FirstOrDefault(); if (_updateUser != null) { _updateUser.UserName = model.UserName; _updateUser.InternalEmailID = model.InternalEmailID; _updateUser.ExternalEmailID = model.ExternalEmailID; _updateUser.Password = model.Password; _updateUser.RankUser = model.RankUser; _updateUser.IPAddress = model.IPAddress; _updateUser.MacAddress = model.MacAddress; _updateUser.Phone = model.Phone; _updateUser.SectionID = model.UserTypeId; _updateUser.DepartmentID = model.DepartmentID; _updateUser.ValidFrom = Convert.ToDateTime(model.ValidFrom); _updateUser.ValidTill = Convert.ToDateTime(model.ValidTill); _updateUser.Designation = model.Designation; _updateUser.LoginAllowed = model.LoginAllowed; _updateUser.Pswd_Salt = hashString; _updateUser.CreatedBy = Convert.ToInt32(Session["UserID"]); _updateUser.CreatedOn = System.DateTime.Now; _updateUser.IsDeleted = false; _entities.SaveChanges(); } } catch (Exception ex) { throw ex; } return(Redirect("Index")); }