I am trying to implement validation on a custom data attribute through the PreRegistrationHandler
. This works great when it passes validation.
However, when it does not, it creates the account anyway. When validation does not pass, I return a Task result code of one which should make it fail.
PreRegistrationHandler = (context, cancellationToken) =>
{
var passesvalidation = DoesPassValidation(context); // evals to false
if (!passesvalidation)
{
return Task.FromResult(1); //should fail and not create account, but does anyway
}
return Task.FromResult(0); // passes
}
Is there an undocumented return code that I should be using? I've checked here: https://docs.stormpath.com/dotnet/aspnet/latest/registration.html#pre-registration-handler
This functionality works as of version 0.9.0 of the Stormpath ASP.NET plugin.
The syntax for failing validation inside of the
PreRegistrationHandler
is: