本文整理汇总了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
}
示例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
}
示例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
}
示例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
}