"""
Custom pipeline functions for Python Social Auth.
These functions are called during the social authentication process.
"""


def activate_user(strategy, details, user=None, *args, **kwargs):
    """
    Custom pipeline step to ensure social auth users are active.
    
    This ensures that users who register via social login don't need
    email activation - they are automatically activated since the social
    provider has already verified their email.
    """
    if user and not user.is_active:
        user.is_active = True
        user.save(update_fields=['is_active'])
    return {'user': user}

