I implemented Django signals to handle some actions after login, but I'd also like to be able to cancel the login actions:
I have this:
@receiver(user_logged_in)
def my_signal(sender, **kwargs):
request, user = kwargs['request'], kwargs['user']
# some actions
I want something like this:
@receiver(user_logged_in)
def my_signal(sender, **kwargs):
request, user = kwargs['request'], kwargs['user']
if "any validation" == True:
# some actions
else:
# cancel login
Is that possible? If so, how can I do it? Well, you can think that I could validate before call auth.login(request, user)
but let me know if it is possible. Thanks in advance.