public IActionResult ExcludeCommonPasswordsPolicy(Policy policy, int projectId, ExcludeCommonPasswordsConfiguration policySettings) { try { savePolicyToProjectFactory.Create().Invoke(projectId, policy, policySettings); Alert(AlertType.Success, "Policy saved correctly."); return(RedirectToAction("GetById", "Projects", new { id = projectId })); } catch (Exception ex) { Alert(AlertType.Warning, ex.Message); return(View("ErrorPage")); } }
public static bool ExcludeCommonPasswords(ExcludeCommonPasswordsConfiguration config, string password) { using (var stream = File.OpenText(@"common_passwords_list.txt")) { while (!stream.EndOfStream) { var commonPassword = stream.ReadLine(); if (password == commonPassword) { return(false); } } } return(true); }