@receiver(user_logged_in)
def post_login_handler(sender, request, user, **kwargs):
 if (getattr(user, u'backend', u'').endswith(u'.EmailAuth') and (not user.has_usable_password())):
  request.session[u'show_set_password'] = True
 profile = Profile.objects.get_or_create(user=user)[0]
 if (user.has_usable_password() and user.email and (not user.social_auth.filter(provider=u'email').exists())):
  social = user.social_auth.create(provider=u'email', uid=user.email)
  VerifiedEmail.objects.create(social=social, email=user.email)
 set_lang(request, profile)
 if (not user.email):
  messages.error(request, _(u'You can not submit translations as you do not have assigned any email address.'))

@ receiver ( user_logged_in ) def post_login_handler ( sender , request , user , ** kwargs ) : if ( getattr ( user , u'backend' , u'' ) . endswith ( u'.EmailAuth' ) and ( not user . has_usable_password ( ) ) ) : request . session [ u'show_set_password' ] = True profile = Profile . objects . get_or_create ( user = user ) [ 0 ] if ( user . has_usable_password ( ) and user . email and ( not user . social_auth . filter ( provider = u'email' ) . exists ( ) ) ) : social = user . social_auth . create ( provider = u'email' , uid = user . email ) VerifiedEmail . objects . create ( social = social , email = user . email ) set_lang ( request , profile ) if ( not user . email ) : messages . error ( request , _ ( u'You can not submit translations as you do not have assigned any email address.' ) )
signal handler for setting user language and migrating profile if needed .