当前位置: 首页>>代码示例>>Python>>正文


Python User.create_confirmed方法代码示例

本文整理汇总了Python中framework.auth.core.User.create_confirmed方法的典型用法代码示例。如果您正苦于以下问题:Python User.create_confirmed方法的具体用法?Python User.create_confirmed怎么用?Python User.create_confirmed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在framework.auth.core.User的用法示例。


在下文中一共展示了User.create_confirmed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_or_create_user

# 需要导入模块: from framework.auth.core import User [as 别名]
# 或者: from framework.auth.core.User import create_confirmed [as 别名]
def get_or_create_user(fullname, address, is_spam=False):
    """Get or create user by email address.

    :param str fullname: User full name
    :param str address: User email address
    :param bool is_spam: User flagged as potential spam
    :return: Tuple of (user, created)
    """
    user = get_user(email=address)
    if user:
        return user, False
    else:
        password = str(uuid.uuid4())
        user = User.create_confirmed(address, password, fullname)
        user.verification_key = generate_verification_key()
        if is_spam:
            user.system_tags.append('is_spam')
        return user, True
开发者ID:atelic,项目名称:osf.io,代码行数:20,代码来源:__init__.py

示例2: get_or_create_user

# 需要导入模块: from framework.auth.core import User [as 别名]
# 或者: from framework.auth.core.User import create_confirmed [as 别名]
def get_or_create_user(fullname, address, reset_password=True, is_spam=False):
    """
    Get or create user by fullname and email address.

    :param str fullname: user full name
    :param str address: user email address
    :param boolean reset_password: ask user to reset their password
    :param bool is_spam: user flagged as potential spam
    :return: tuple of (user, created)
    """
    user = get_user(email=address)
    if user:
        return user, False
    else:
        password = str(uuid.uuid4())
        user = User.create_confirmed(address, password, fullname)
        if password:
            user.verification_key_v2 = generate_verification_key(verification_type='password')
        if is_spam:
            user.system_tags.append('is_spam')
        return user, True
开发者ID:alexschiller,项目名称:osf.io,代码行数:23,代码来源:__init__.py


注:本文中的framework.auth.core.User.create_confirmed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。