public async Task <IActionResult> ResetPassword(UserForResetPasswordDTO model) { var result = await _authService.ResetPasswordAsync(model); if (result.Success) { return(Ok(result.Message)); } return(BadRequest(result.Success)); }
public async Task <IResult> ResetPasswordAsync(UserForResetPasswordDTO userForResetPasswordDto) { IDataResult <User> user = await FindUserByUserIdAsync(userForResetPasswordDto.UserId); if (!user.Success) { return(user); } var revisedCode = userForResetPasswordDto.Code.Replace(" ", "+"); var result = await _userManager.ResetPasswordAsync(user.Data, revisedCode, userForResetPasswordDto.Password); if (result.Succeeded) { return(new SuccessResult(Messages.PasswordChanged)); } return(new ErrorResult(Messages.Error)); }
public async Task <IHttpActionResult> ResetPassword(UserForResetPasswordDTO model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var user = await UserManager.FindByIdAsync(model.UserId); if (user == null) { return(BadRequest("Kullanıcı Bulunamadı")); } var revisedCode = model.Code.Replace(" ", "+"); var result = await UserManager.ResetPasswordAsync(user.Id, revisedCode, model.Password); if (result.Succeeded) { return(Ok()); } return(BadRequest("Bir Hata Oluştu")); }