コード例 #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
コード例 #2
0
def make_user(login, testcase=None, password=None):
    from pas.plugins.authomatic.useridentities import UserIdentities
    uis = UserIdentities(login)
    if password:
        uis._secret = password
    if testcase:
        testcase.plugin._useridentities_by_userid[login] = uis
    mock_result = MockResult(provider=MockResult(name='mock_provider'),
                             user=MockResult())
    uis.handle_result(mock_result)
    return uis
コード例 #3
0
def make_user(login, testcase=None, password=None):
    from pas.plugins.authomatic.useridentities import UserIdentities
    uis = UserIdentities(login)
    if password:
        uis._secret = password
    if testcase:
        testcase.plugin._useridentities_by_userid[login] = uis
    mock_result = MockResult(
        provider=MockResult(name='mock_provider'),
        user=MockResult()
    )
    uis.handle_result(mock_result)
    return uis
コード例 #4
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
コード例 #5
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