public async Task <IActionResult> ResetPassword(ResetPasswordInputModel model) { if (!ModelState.IsValid) { return(View(model)); } User user; using (_db.DisableTenantFilter()) { user = await _userManager.FindByIdAsync(model.UserId); if (user == null) { ModelState.AddModelError(nameof(model.UserId), "User wasn't found"); return(View(model)); } } _db.SetTenantFilterValue(user.TenantId); var identityResult = await _userManager.ResetPasswordAsync(user, model.Code, model.NewPassword); if (!identityResult.Succeeded) { var error = identityResult.Errors.FirstOrDefault(); var errorMessage = error != null ? error.Code + ": " + error.Description : "Identity error"; ModelState.AddModelError("", errorMessage); return(View(model)); } return(RedirectToAction("PasswordResetSuccess")); }
private async Task <User> GetUserAsync(string subjectId) { using (_db.DisableTenantFilter()) { return(await _userManager.FindByIdAsync(subjectId)); } }
public void SeedProjectsAndTasks() { //When _dbInitializer.Initialize(); //Then using (_db.DisableTenantFilter()) { Assert.True(_db.Projects.AnyAsync().GetAwaiter().GetResult()); Assert.True(_db.Tasks.AnyAsync().GetAwaiter().GetResult()); } }