public async Task <UsuarioDto> Get(string cuenta) { var usuario = await UserManager.FindByNameAsync(cuenta); var output = MapToEntityDto(usuario); return(output); }
public async Task <ActionResult> ChangeData() { var userData = await AspUserManager.FindByNameAsync(User.Identity.Name); var viewModel = new AdminDataViewModel { FirstName = userData.FirstName, LastName = userData.LastName, Email = userData.Email }; return(View(viewModel)); }
public async Task <ActionResult> ChangePassword(ChangePasswordViewModel model) { if (!ModelState.IsValid) { return(View(model)); } var result = await AspUserManager.ChangePasswordAsync(User.Identity.GetUserId(), model.OldPassword, model.NewPassword); if (result.Succeeded) { var user = await AspUserManager.FindByNameAsync(User.Identity.GetUserId()); if (user != null) { await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); } return(RedirectToAction("Index", new { Message = Message.ChagnePasswordSuccess })); } else { TempData["Alert"] = SetAlert.Set("Wprowadzone hasło jest niepoprawne!", "Błąd", AlertType.Danger); return(View(model)); } }