1
0
mirror of https://github.com/bitwarden/server synced 2025-12-12 22:33:45 +00:00

Ac/pm 17449/add managed user validation to email token (#5437)

This commit is contained in:
Jimmy Vo
2025-02-24 10:42:04 -05:00
committed by GitHub
parent 6bc579f51e
commit 6ca98df721
5 changed files with 52 additions and 11 deletions

View File

@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc.ModelBinding;
namespace Bit.Core.Exceptions;
@@ -29,5 +30,16 @@ public class BadRequestException : Exception
ModelState = modelState;
}
public BadRequestException(IEnumerable<IdentityError> identityErrors)
: base("The model state is invalid.")
{
ModelState = new ModelStateDictionary();
foreach (var error in identityErrors)
{
ModelState.AddModelError(error.Code, error.Description);
}
}
public ModelStateDictionary ModelState { get; set; }
}