Return 401 in case the signin was not successfully (#16258)

This commit is contained in:
Bjarke Berg
2024-05-10 11:27:34 +02:00
committed by GitHub
parent 53654d3b28
commit 86d98eda8d

View File

@@ -94,7 +94,15 @@ public class BackOfficeController : SecurityControllerBase
EnabledTwoFactorProviderNames = enabledProviders
});
}
return Ok();
if (result.Succeeded)
{
return Ok();
}
return StatusCode(StatusCodes.Status401Unauthorized, new ProblemDetailsBuilder()
.WithTitle("Invalid credentials")
.WithDetail("The provided credentials are invalid. User has not been signed in.")
.Build());
}
[AllowAnonymous]