Question: PreRegistrationHandler not failing on Task error code

Question

PreRegistrationHandler not failing on Task error code

Answers 1
Added at 2016-12-28 16:12
Tags
Question

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

Answers to

PreRegistrationHandler not failing on Task error code

nr: #1 dodano: 2016-12-28 18:12

Is there an undocumented return code that I should be using?

No, this use case just isn't supported out of the box. (yet!) It's likely that the implementation will look exactly like the code you are using.

I created an issue to track this. I'll update this answer when this functionality is released.

Source Show
◀ Wstecz