How to abort login process from User_Validated

I’m a little bit confused about the User_Validated method.

I’m using standard ANM validation (users,userlevels and userlevelspermission).

I need that when a user is authenticated (so username and password are checked and valid), I need to check also if the “users” table’s “blockeduser” field is false.

How can I do this? before I used the User_Validated, but now how can I abort the login process if the field is not as expected? before it was a “bool” method, now it is void.

Thanks.

You can try logout the user manually in the User_LoggedIn server event. For example:

await Security.LogoutAsync();

await _signInManager.SignOutAsync();

Alternatively, you can enable the User Registration Page → Requires activation setting so that when the Activated field is false, the user cannot login.

ok, thank you, but how can I put a FailureMessage like “Login failed due to blocked user, please contact administrator”?

Compared to what could be done with older versions, the current implementation seems like a step backwards. Perhaps you could implement a “User_Validating” boolean method, respecting the logic you’ve successfully implemented in other methods:

public bool User_Validating(IAdvancedUser user) {
//return false if custom check fails
return true;
}