django - Python Social Auth - Redirect to a URL after raising an AuthException -
when user try login in website using google account check if gmail registered in db.
this pipeline.py
def check_email(request, backend, details, uid, user=none, *args, **kwargs): if backend.name == 'google-oauth2': # verifica se é um usuário jah existente pelo google, e que apenas vai fazer o login if uid , user: pass # se ele não existe é pq será registrado else: # pega o e-mail cara que vai ser registado email = details.get('email', '') # procura na db se existe algum email parecido, se existir volta pro login count = user.objects.filter(email=email).count() if count>0: raise authexception(backend, 'not unique email address.')
the error raised @ browse: exception raised
so, wondering how redirect login page again message.
i tryed use httpredirect, works fine, not possible use django message framework during pipeline process.
please, note event happens in middle of pipeline process.
social_auth_pipeline = ( 'social.pipeline.social_auth.social_details', 'social.pipeline.social_auth.social_uid', 'social.pipeline.social_auth.auth_allowed', 'social.pipeline.social_auth.social_user', 'account.my_pipeline.check_email', 'social.pipeline.user.get_username', 'social.pipeline.user.create_user', 'social.pipeline.social_auth.associate_user', 'social.pipeline.user.user_details' )
thanks
Comments
Post a Comment