From 2e62a6c5f253b1012d24c6518c5fb86d896bb9d4 Mon Sep 17 00:00:00 2001 From: Elitsa Marinovska Date: Wed, 13 Jan 2021 11:29:56 +0100 Subject: [PATCH] Reverting the change of BadRequest() back to ValidationErrorResult --- .../Controllers/UsersController.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Web.BackOffice/Controllers/UsersController.cs b/src/Umbraco.Web.BackOffice/Controllers/UsersController.cs index 17b845c9e0..6a7d8a468c 100644 --- a/src/Umbraco.Web.BackOffice/Controllers/UsersController.cs +++ b/src/Umbraco.Web.BackOffice/Controllers/UsersController.cs @@ -121,7 +121,7 @@ namespace Umbraco.Web.BackOffice.Controllers { var urls = _backofficeSecurityAccessor.BackOfficeSecurity.CurrentUser.GetUserAvatarUrls(_appCaches.RuntimeCache, _mediaFileSystem, _imageUrlGenerator); if (urls == null) - return BadRequest("Could not access Gravatar endpoint"); + return new ValidationErrorResult("Could not access Gravatar endpoint"); return urls; } @@ -531,7 +531,7 @@ namespace Umbraco.Web.BackOffice.Controllers ModelState.AddModelError( _securitySettings.UsernameIsEmail ? "Email" : "Username", "A user with the username already exists"); - return BadRequest(ModelState); + return new ValidationErrorResult(new SimpleValidationModel(ModelState.ToErrorDictionary())); } return new ActionResult(user); @@ -586,7 +586,7 @@ namespace Umbraco.Web.BackOffice.Controllers if (ModelState.IsValid == false) { - return BadRequest(ModelState); + return new ValidationErrorResult(new SimpleValidationModel(ModelState.ToErrorDictionary())); } var intId = userSave.Id.TryConvertTo(); @@ -649,7 +649,7 @@ namespace Umbraco.Web.BackOffice.Controllers } if (hasErrors) - return BadRequest(ModelState); + return new ValidationErrorResult(new SimpleValidationModel(ModelState.ToErrorDictionary())); //merge the save data onto the user var user = _umbracoMapper.Map(userSave, found); @@ -673,7 +673,7 @@ namespace Umbraco.Web.BackOffice.Controllers if (ModelState.IsValid == false) { - return BadRequest(ModelState); + return new ValidationErrorResult(new SimpleValidationModel(ModelState.ToErrorDictionary())); } var intId = changingPasswordModel.Id.TryConvertTo();