Ejemplo n.º 1
0
    def remember_identity(self, result, userid=None):
        """stores authomatic result data
        """
        if userid is None:
            # create a new userid
            userid = new_userid(self, result)
            useridentities = UserIdentities(userid)
            self._useridentities_by_userid[userid] = useridentities
        else:
            # use existing userid
            useridentities = self._useridentities_by_userid.get(userid, None)
            if useridentities is None:
                raise ValueError('Invalid userid')
        provider_id = self._provider_id(result)
        if provider_id in self._userid_by_identityinfo and self._userid_by_identityinfo[
                provider_id] != userid:
            # This provider's identity is already registered for other user
            raise ValueError(
                "Your %s account is already linked with other id. \
                              Please login and unlink first." % provider_id[0])
        if provider_id not in self._userid_by_identityinfo:
            self._userid_by_identityinfo[provider_id] = userid

        useridentities.handle_result(result)
        return useridentities
Ejemplo n.º 2
0
    def remember_identity(self, result, userid=None):
        """stores authomatic result data"""
        if userid is None:
            # create a new userid
            userid = new_userid(self, result)
            useridentities = UserIdentities(userid)
            self._useridentities_by_userid[userid] = useridentities
        else:
            # use existing userid
            useridentities = self._useridentities_by_userid.get(userid, None)
            if useridentities is None:
                raise ValueError("Invalid userid")
        provider_id = self._provider_id(result)
        if provider_id not in self._userid_by_identityinfo:
            self._userid_by_identityinfo[provider_id] = userid

        useridentities.handle_result(result)
        return useridentities
Ejemplo n.º 3
0
    def remember_identity(self, result, userid=None):
        """stores authomatic result data
        """
        if userid is None:
            # create a new userid
            userid = new_userid(self, result)
            useridentities = UserIdentities(userid)
            self._useridentities_by_userid[userid] = useridentities
        else:
            # use existing userid
            useridentities = self._useridentities_by_userid.get(userid, None)
            if useridentities is None:
                raise ValueError('Invalid userid')

        if self._provider_id(result) not in self._userid_by_identityinfo:
            self._userid_by_identityinfo[self._provider_id(result)] = userid

        useridentities.handle_result(result)
        return useridentities