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


Python UserSocialAuth.email_max_length方法代码示例

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


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

示例1: create_user

# 需要导入模块: from social_auth.models import UserSocialAuth [as 别名]
# 或者: from social_auth.models.UserSocialAuth import email_max_length [as 别名]
def create_user(backend, details, response, uid, username, user=None, *args,
                **kwargs):

    """Create user. Depends on get_username pipeline."""

    if user:
        return {'user': user}
    if not username:
        return None

    # Avoid hitting field max length
    email = details.get('email')
    original_email = None

    # There seems to be something odd about the Github orgs backend; we're getting dicts here instead of strings.
    if isinstance(email, dict):
        email = email.get('email', None)

    if email and UserSocialAuth.email_max_length() < len(email):
        original_email = email
        email = ''


    return {
        'user': UserSocialAuth.create_user(username=username, email=email),
        'original_email': original_email,
        'is_new': True
    }
开发者ID:alaindomissy,项目名称:ipydoc,代码行数:30,代码来源:authpipe.py

示例2: create_user

# 需要导入模块: from social_auth.models import UserSocialAuth [as 别名]
# 或者: from social_auth.models.UserSocialAuth import email_max_length [as 别名]
def create_user(backend, details, response, uid, username, user=None, *args,
                **kwargs):
    """Create user. Depends on get_username pipeline."""
    print user
    if user:
        return {'user': user}
    if not username:
        return None

    # Avoid hitting field max length
    email = details.get('email')
    original_email = None
    if type(email) is dict and email.get('email'):
        email = email.get('email')
        details['email'] = email
    
    if email and UserSocialAuth.email_max_length() < len(email):
        original_email = email
        email = ''

    return {
        'user': UserSocialAuth.create_user(username=username, email=email),
        'original_email': original_email,
        'is_new': True
    }
开发者ID:mburst,项目名称:problemotd,代码行数:27,代码来源:user.py

示例3: create_user

# 需要导入模块: from social_auth.models import UserSocialAuth [as 别名]
# 或者: from social_auth.models.UserSocialAuth import email_max_length [as 别名]
def create_user(backend, details, response, uid, username, user=None,
                *args, **kwargs):
    """Create user. Depends on get_username pipeline."""
    if user:
        return {'user': user}
    if not username:
        return None

    # Avoid hitting field max length
    email = details.get('email')
    original_email = None

    if not email:
        message = _("""your social account needs to have a verified email address in order to proceed.""")
        raise AuthFailed(backend, message)

    if email and UserSocialAuth.email_max_length() < len(email):
        original_email = email
        email = ''

    return {
        'user': UserSocialAuth.create_user(username=username, email=email,
                                           sync_emailaddress=False),
        'original_email': original_email,
        'is_new': True
    }
开发者ID:alfinal,项目名称:nodeshot,代码行数:28,代码来源:pipeline.py

示例4: create_user

# 需要导入模块: from social_auth.models import UserSocialAuth [as 别名]
# 或者: from social_auth.models.UserSocialAuth import email_max_length [as 别名]
def create_user(backend, details, response, uid, username, user=None, *args,
                **kwargs):
    """Create user. Depends on get_username pipeline."""
    u = User.objects.filter(email=details.get('email'))
    if len(u) > 0:
        return {'user': u[0]}

    # Avoid hitting field max length
    email = details.get('email')
    original_email = None
    if email and UserSocialAuth.email_max_length() < len(email):
        original_email = email
        email = ''

    return {
        'user': UserSocialAuth.create_user(username=username, email=email),
        'original_email': original_email,
        'is_new': True
    }
开发者ID:abhidrona,项目名称:gn-social-api,代码行数:21,代码来源:user.py


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