(email, password)
return "Invalid fallthrough", False
Used to validate user across apps. Returns a tuple ( login message, False or True )
Used to validate user across apps. Returns a tuple ( login message, False or True )
Used to validate user across apps . Returns a tuple ( login message False or True )
def validate_login(email, password):
    """
    Used to validate user across apps. Returns a tuple ( login message, False or True )
    """

    user = User.objects.filter(email__iexact=email).order_by('-id').first()

    if not user:
        return "This email does not exist.", False

    user = auth.authenticate(username=user.username, password=password)

    if not user:
        return "Invalid Password", False

    if not user.profile.is_valid:
        msg = f"Login not allowed. Account is not valid."
        return msg,  False

    elif user and not user.is_active:
        return "This user is not active.", False

    elif user and user.is_active:
        return "Login successful!", True

    return "Invalid fallthrough", False
def validate_login ( email , password ) : user = User . objects . filter ( email__iexact = email ) . order_by ( '-id' ) . first ( ) if not user : return "This email does not exist." , False user = auth . authenticate ( username = user . username , password = password ) if not user : return "Invalid Password" , False if not user . profile . is_valid : msg = f"Login not allowed. Account is not valid." return msg , False elif user and not user . is_active : return "This user is not active." , False elif user and user . is_active : return "Login successful!" , True return "Invalid fallthrough" , False