/// <summary> /// Updates the user password. /// </summary> /// <param name="storefront">The storefront.</param> /// <param name="visitorContext">The visitor context.</param> /// <param name="inputModel">The input model.</param> /// <returns>The manager response.</returns> public virtual ManagerResponse<UpdatePasswordResult, bool> UpdateUserPassword([NotNull] CommerceStorefront storefront, [NotNull] VisitorContext visitorContext, ChangePasswordInputModel inputModel) { Assert.ArgumentNotNull(storefront, "storefront"); Assert.ArgumentNotNull(visitorContext, "visitorContext"); Assert.ArgumentNotNull(inputModel, "inputModel"); Assert.ArgumentNotNullOrEmpty(inputModel.OldPassword, "inputModel.OldPassword"); Assert.ArgumentNotNullOrEmpty(inputModel.NewPassword, "inputModel.NewPassword"); var userName = visitorContext.UserName; var request = new UpdatePasswordRequest(userName, inputModel.OldPassword, inputModel.NewPassword); var result = this.CustomerServiceProvider.UpdatePassword(request); if (!result.Success && !result.SystemMessages.Any()) { var message = StorefrontManager.GetSystemMessage("PasswordCouldNotBeReset"); result.SystemMessages.Add(new SystemMessage { Message = message }); } if (!result.Success) { Helpers.LogSystemMessages(result.SystemMessages, result); } return new ManagerResponse<UpdatePasswordResult, bool>(result, result.Success); }
public async Task <IActionResult> UpdatePasswordByAdmin([FromRoute] long userId, [FromBody] UpdatePasswordRequest passwordRequest) { var successful = await _userService.UpdatePasswordAdmin(userId, passwordRequest); if (successful) { return(Ok(true)); } return(BadRequest("Failed to update password")); }
public async Task <IActionResult> ChangePassword(UpdatePasswordRequest request, CancellationToken ct) { return(Ok(await Mediator.Send(request, ct).ConfigureAwait(false))); }
public async Task <IActionResult> ChangePasswordAsync([FromBody] UpdatePasswordRequest request) { await UserService.ChangePasswordAsync(null, request.OldPassword, request.NewPassword); return(Success()); }
public async Task <ActionResult <UserDto> > UpdateUserPasswordAsync([FromBody] UpdatePasswordRequest request) => _viewMapper.ServiceResultToContentResult (await _userService.UpdatePasswordAsync(UserId, request));
public static BaseResponse UpdatePassword(UpdatePasswordRequest ahRequest) { return(GetResponse(Methods.UPDATEPASSWORD, ahRequest)); }