public async Task <IActionResult> ChangePassword(ChangePasswordViewModel vm) { if (!ModelState.IsValid) { return(View(vm)); } try { await _usersDao.ChangePasswordAsync( vm.UserId, vm.CurrentPassword, vm.NewPassword); } catch (IdentityException e) { foreach (var error in e.Errors) { ModelState.AddModelError("", error); } } catch (Exception e) { ModelState.AddModelError("", e.Message); } TempData.Set("message", MessageViewModel.MakeInfo("Password changed")); return(View(vm)); }