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:
@@ -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; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user