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


Python GsuserManager.handle_user_via_refhash方法代码示例

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


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

示例1: bind

# 需要导入模块: from gitshell.gsuser.models import GsuserManager [as 别名]
# 或者: from gitshell.gsuser.models.GsuserManager import handle_user_via_refhash [as 别名]
def bind(request, ref_hash):
    userViaRef = None
    if ref_hash:
        userViaRef = GsuserManager.get_userViaRef_by_refhash(ref_hash)
        GsuserManager.handle_user_via_refhash(request.user, ref_hash)
    if userViaRef:
        is_verify = 1
        if userViaRef.ref_type == REF_TYPE.VIA_REPO_MEMBER:
            GsuserManager.add_useremail(request.user, userViaRef.email, is_verify)
            return HttpResponseRedirect('/%s/%s/' % (userViaRef.first_refname, userViaRef.second_refname))
        elif userViaRef.ref_type == REF_TYPE.VIA_TEAM_MEMBER:
            GsuserManager.add_useremail(request.user, userViaRef.email, is_verify)
            return HttpResponseRedirect('/%s/' % (userViaRef.first_refname))
    return HttpResponseRedirect('/dashboard/')
开发者ID:ZheYuan,项目名称:gitshell,代码行数:16,代码来源:views.py

示例2: _create_user_and_authenticate

# 需要导入模块: from gitshell.gsuser.models import GsuserManager [as 别名]
# 或者: from gitshell.gsuser.models.GsuserManager import handle_user_via_refhash [as 别名]
    return recommends_vo

def _create_user_and_authenticate(request, username, email, password, ref_hash, is_verify):
    user = None
    try:
        user = User.objects.create_user(username, email, password)
        if user is None or not user.is_active:
            return False
    except IntegrityError, e:
        logger.exception(e)
        return False
    user = auth_authenticate(username=user.username, password=password)
    auth_login(request, user)
    userprofile = Userprofile(id = user.id, username = user.username, email = user.email, imgurl = hashlib.md5(user.email.lower()).hexdigest())
    userprofile.save()
    userEmail = UserEmail(user_id = user.id, email = user.email, is_verify = is_verify, is_primary = 1, is_public = 1)
    userEmail.save()
    if ref_hash:
        GsuserManager.handle_user_via_refhash(user, ref_hash)
    return True

def _get_client_ip(request):
    x_forwarded_for = request.META.get('X-Forwarded-For')
    if x_forwarded_for:
        ip = x_forwarded_for.split(',')[0]
    else:
        ip = request.META.get('REMOTE_ADDR')
    return ip

# Note: add email unique support ! UNIQUE KEY `email` (`email`) #
开发者ID:ZheYuan,项目名称:gitshell,代码行数:32,代码来源:views.py


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