Exemple #1
0
def save_profile(backend, user, response, request, *args, **kwargs):
    """Associate a Profile with a User."""
    if backend.name == 'github':
        handle = user.username

        # BLOCKEDUSER BASED BLOCKING
        # COUNTRY-BASED BASED BLOCKING
        if is_blocked(handle):
            raise SuspiciousOperation('You cannot login')

        # INACTIVE USERS
        if not user.is_active:
            raise SuspiciousOperation('You cannot login')

        ## IP BASED BLOCKING
        from retail.helpers import get_ip
        ip_addr = get_ip(request)
        from dashboard.models import BlockedIP
        _is_blocked = BlockedIP.objects.filter(addr=ip_addr).exists()
        if _is_blocked:
            raise SuspiciousOperation('You cannot login')

        # SUCCESS, LET USER LOGIN
        sync_profile(handle, user, hide_profile=False, delay_okay=True)
        setup_lang(request, user)
Exemple #2
0
def save_profile(backend, user, response, request, *args, **kwargs):
    """Associate a Profile with a User."""
    if backend.name == 'github':
        handle = user.username
        if handle in settings.BLOCKED_USERS:
            raise SuspiciousOperation('You cannot login')

        sync_profile(handle, user, hide_profile=False)
        setup_lang(request, user)
Exemple #3
0
def save_profile(backend, user, response, request, *args, **kwargs):
    """Associate a Profile with a User."""
    if backend.name == 'github':
        handle = user.username
        if is_blocked(handle):
            raise SuspiciousOperation('You cannot login')

        if not user.is_active:
            raise SuspiciousOperation('You cannot login')

        sync_profile(handle, user, hide_profile=False)
        setup_lang(request, user)
Exemple #4
0
def save_profile(backend, user, response, request, *args, **kwargs):
    """Associate a Profile with a User."""
    if backend.name == 'github':
        handle = user.username
        sync_profile(handle, user, hide_profile=False)
        setup_lang(request, user)