def on_logged_in(self, request, openid, openid_response):
        # Do we recognise their OpenID?
        matches = self.lookup_openid(request, openid)
        # Are they logged in already?
        if request.user.is_authenticated():
            # Did we find their account already? If so, ignore login
            if request.user.id in [u.id for u in matches]:
                response = self.redirect_if_valid_next(request)
                if not response:
                    response = Redirect(self.after_login_redirect_url)
                return response
            else:
                # Offer to associate this OpenID with their account
                return self.show_associate(request, openid)
        if matches:
            # If there's only one match, log them in as that user
            if len(matches) == 1:
                user = matches[0]
                if self.user_can_login(request, user):
                    self.log_in_user(request, user)
                    return self.on_login_complete(request, user, openid)
                else:
                    # User is not allowed to log in for some other reason - 
                    # for example, they have not yet validated their e-mail 
                    # or they have been banned from the site.
                    return self.show_you_cannot_login(request, user, openid)
            # Otherwise, let them to pick which account they want to log in as
            else:
                return self.show_pick_account(request, openid)
        else:
            # We don't know anything about this openid
            return self.show_unknown_openid(request, openid)
dataset/ETHPy150Open amarandon/smeuhsocial/apps/django_openid/auth.py/AuthConsumer.on_logged_in/original