diff --git a/Machete.Web/Controllers/Api/EmployersController.cs b/Machete.Web/Controllers/Api/EmployersController.cs index d849d280b..c3f20dfc6 100644 --- a/Machete.Web/Controllers/Api/EmployersController.cs +++ b/Machete.Web/Controllers/Api/EmployersController.cs @@ -171,8 +171,8 @@ public ActionResult ProfilePut([FromBody]EmployerViewModel viewmodel) newEmployer = true; } employer.onlineSigninID = UserSubject; - employer.email = UserEmail; map.Map(viewmodel, employer); + employer.email = UserEmail; Domain.Employer result; if (newEmployer) diff --git a/Machete.Web/Controllers/Legacy/AccountController.cs b/Machete.Web/Controllers/Legacy/AccountController.cs index d25db2a14..6bb79edff 100644 --- a/Machete.Web/Controllers/Legacy/AccountController.cs +++ b/Machete.Web/Controllers/Legacy/AccountController.cs @@ -362,12 +362,13 @@ public async Task Edit([Bind]EditUserViewModel model) { var user = _context.Users.First(u => u.Id == model.Id); var macheteUserName = model.FirstName.Trim() + "." + model.LastName.Trim(); - var dupeUser = await _userManager.FindByEmailAsync(model.Email); user.UserName = macheteUserName; user.LoweredUserName = macheteUserName.ToLower(); - if (dupeUser != null && dupeUser.Email == model.Email) + //Check for duplicate emails, if any, show error message + var dupeUserCount = _context.Users.Count(u => u.Email == model.Email && u.Id != model.Id); + if (dupeUserCount > 0) { - ModelState.AddModelError("ErrorMessage", ValidationStrings.dupeEmail); + ModelState.AddModelError("", ValidationStrings.dupeEmail); return View(model); } user.Email = model.Email.Trim(); diff --git a/Machete.Web/StartupConfiguration.cs b/Machete.Web/StartupConfiguration.cs index 3171cc4f6..c80be0679 100644 --- a/Machete.Web/StartupConfiguration.cs +++ b/Machete.Web/StartupConfiguration.cs @@ -83,12 +83,12 @@ public static void ConfigureAuthentication(this IServiceCollection services, ICo services.Configure(options => { // Password settings; we are relying on validation - options.Password.RequireDigit = false; - options.Password.RequiredLength = 6; + options.Password.RequireDigit = true; + options.Password.RequiredLength = 8; options.Password.RequireNonAlphanumeric = false; - options.Password.RequireUppercase = false; + options.Password.RequireUppercase = true; options.Password.RequireLowercase = false; - options.Password.RequiredUniqueChars = 0; + options.Password.RequiredUniqueChars = 6; // Lockout settings options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(30);