• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python views.complete函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中social.apps.django_app.views.complete函数的典型用法代码示例。如果您正苦于以下问题:Python complete函数的具体用法?Python complete怎么用?Python complete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: register

def register(request):
    '''
    Registration form.
    '''
    if appsettings.REGISTRATION_CAPTCHA:
        form_class = CaptchaRegistrationForm
    else:
        form_class = RegistrationForm

    if request.method == 'POST':
        form = form_class(request.POST)
        if form.is_valid() and appsettings.REGISTRATION_OPEN:
            return complete(request, 'email')
    else:
        form = form_class()

    backends = load_backends(BACKENDS).keys()

    # Redirect if there is only one backend
    if len(backends) == 1 and backends[0] != 'email':
        return redirect('social:begin', backends[0])

    backends = set(backends)

    return render(
        request,
        'accounts/register.html',
        {
            'registration_email': 'email' in backends,
            'registration_backends': backends - set(['email']),
            'title': _('User registration'),
            'form': form,
        }
    )
开发者ID:ejjoman,项目名称:weblate,代码行数:34,代码来源:views.py


示例2: register

def register(request):
    """
    Registration form.
    """
    if appsettings.REGISTRATION_CAPTCHA:
        form_class = CaptchaRegistrationForm
    else:
        form_class = RegistrationForm

    if request.method == "POST":
        form = form_class(request.POST)
        if form.is_valid() and appsettings.REGISTRATION_OPEN:
            return complete(request, "email")
    else:
        form = form_class()

    backends = set(load_backends(BACKENDS).keys())

    return render(
        request,
        "accounts/register.html",
        {
            "registration_email": "email" in backends,
            "registration_backends": backends - set(["email"]),
            "title": _("User registration"),
            "form": form,
        },
    )
开发者ID:electrolinux,项目名称:weblate,代码行数:28,代码来源:views.py


示例3: register

def register(request):
    """
    Registration form.
    """
    if appsettings.REGISTRATION_CAPTCHA:
        form_class = CaptchaRegistrationForm
    else:
        form_class = RegistrationForm

    if request.method == "POST":
        form = form_class(request.POST)
        if form.is_valid() and appsettings.REGISTRATION_OPEN:
            return complete(request, "email")
    else:
        form = form_class()

    backends = load_backends(BACKENDS).keys()

    # Redirect if there is only one backend
    if len(backends) == 1 and backends[0] != "email":
        return redirect("social:begin", backends[0])

    backends = set(backends)

    return render(
        request,
        "accounts/register.html",
        {
            "registration_email": "email" in backends,
            "registration_backends": backends - set(["email"]),
            "title": _("User registration"),
            "form": form,
        },
    )
开发者ID:josben77,项目名称:weblate,代码行数:34,代码来源:views.py


示例4: reset_password

def reset_password(request):
    '''
    Password reset handling.
    '''
    if request.method == 'POST':
        form = ResetForm(request.POST)
        if form.is_valid():
            user = form.cleaned_data['email']
            user.set_unusable_password()
            user.save()
            if not request.session.session_key:
                request.session.create()
            request.session['password_reset'] = True
            return complete(request, 'email')
    else:
        form = ResetForm()

    return render(
        request,
        'accounts/reset.html',
        {
            'title': _('Password reset'),
            'form': form,
        }
    )
开发者ID:blockgiven,项目名称:weblate,代码行数:25,代码来源:views.py


示例5: reset_password

def reset_password(request):
    '''
    Password reset handling.
    '''
    if 'email' not in load_backends(BACKENDS).keys():
        messages.error(
            request,
            _('Can not reset password, email authentication is disabled!')
        )
        return redirect('login')

    if request.method == 'POST':
        form = ResetForm(request.POST)
        if form.is_valid():
            user = form.cleaned_data['email']
            user.set_unusable_password()
            user.save()
            if not request.session.session_key:
                request.session.create()
            request.session['password_reset'] = True
            return complete(request, 'email')
    else:
        form = ResetForm()

    return render(
        request,
        'accounts/reset.html',
        {
            'title': _('Password reset'),
            'form': form,
        }
    )
开发者ID:Intrainos,项目名称:weblate,代码行数:32,代码来源:views.py


示例6: register

def register(request):
    '''
    Registration form.
    '''
    if appsettings.REGISTRATION_CAPTCHA:
        form_class = CaptchaRegistrationForm
    else:
        form_class = RegistrationForm

    if request.method == 'POST':
        form = form_class(request.POST)
        if form.is_valid() and appsettings.REGISTRATION_OPEN:
            return complete(request, 'email')
    else:
        form = form_class()

    backends = set(load_backends(BACKENDS).keys())

    return render(
        request,
        'accounts/register.html',
        {
            'registration_email': 'email' in backends,
            'registration_backends': backends - set(['email']),
            'title': _('User registration'),
            'form': form,
        }
    )
开发者ID:blockgiven,项目名称:weblate,代码行数:28,代码来源:views.py


示例7: get

 def get(self, request, *args, **kwargs):
     backend = kwargs.pop('backend')
     try:
         return complete(request, backend, *args, **kwargs)
     except AuthFailed:
         messages.error(request, "Your domain isn't authorized")
         return HttpResponseRedirect(reverse('login'))
开发者ID:dibits,项目名称:cabot,代码行数:7,代码来源:views.py


示例8: register

def register(request):
    """
    Registration form.
    """
    if appsettings.REGISTRATION_CAPTCHA:
        form_class = CaptchaRegistrationForm
    else:
        form_class = RegistrationForm

    if request.method == "POST":
        form = form_class(request.POST)
        if form.is_valid() and appsettings.REGISTRATION_OPEN:
            return complete(request, "email")
    else:
        form = form_class()

    return render_to_response(
        "accounts/register.html",
        RequestContext(
            request,
            {
                "registration_backends": [x for x in load_backends(BACKENDS).keys() if x != "email"],
                "title": _("User registration"),
                "form": form,
            },
        ),
    )
开发者ID:spc-12,项目名称:weblate,代码行数:27,代码来源:views.py


示例9: reset_password

def reset_password(request):
    """
    Password reset handling.
    """
    if "email" not in load_backends(BACKENDS).keys():
        messages.error(request, _("Can not reset password, email authentication is disabled!"))
        return redirect("login")

    if request.method == "POST":
        form = ResetForm(request.POST)
        if form.is_valid():
            user = form.cleaned_data["email"]
            user.set_unusable_password()
            user.save()

            # Force creating new session
            request.session.create()
            if request.user.is_authenticated():
                logout(request)

            request.session["password_reset"] = True
            return complete(request, "email")
    else:
        form = ResetForm()

    return render(request, "accounts/reset.html", {"title": _("Password reset"), "form": form})
开发者ID:dtschan,项目名称:weblate,代码行数:26,代码来源:views.py


示例10: get

 def get(request, *args, **kwargs):
     backend = kwargs.pop('backend')
     try:
         return complete(request, backend, *args, **kwargs)
     except AuthFailed:
         return HttpResponseRedirect(reverse('login'))
     except AuthAlreadyAssociated:
         return HttpResponseRedirect(reverse('login'))
开发者ID:chwnam,项目名称:lifemotif,代码行数:8,代码来源:views.py


示例11: lti_login_and_complete_view

def lti_login_and_complete_view(request, backend, *args, **kwargs):
    """This is a combination login/complete due to LTI being a one step login"""

    if request.method != 'POST':
        return HttpResponseNotAllowed('POST')

    request.backend.start()
    return complete(request, backend, *args, **kwargs)
开发者ID:10clouds,项目名称:edx-platform,代码行数:8,代码来源:views.py


示例12: email_login

def email_login(request):
    """
    Connect email.
    """
    if request.method == "POST":
        form = EmailForm(request.POST)
        if form.is_valid():
            return complete(request, "email")
    else:
        form = EmailForm()

    return render(request, "accounts/email.html", {"title": _("Register email"), "form": form})
开发者ID:josben77,项目名称:weblate,代码行数:12,代码来源:views.py


示例13: complete

    def complete(self, **kwargs):
        # Before we proceed the auth, clear the session to ensure that no
        # half-backed registrations are left over (this would result in a
        # redirect to extradata after login even if the logged in user has a
        # complete profile.
        self.request.session.clear()

        # Load social strategy to ensure this request looks like a social auth
        # request.
        self.request.social_strategy = load_strategy(backend='username')

        return complete(self.request, 'username', **kwargs)
开发者ID:EnTeQuAk,项目名称:doit,代码行数:12,代码来源:views.py


示例14: reset_password

def reset_password(request):
    """
    Password reset handling.
    """
    if request.method == "POST":
        form = ResetForm(request.POST)
        if form.is_valid():
            user = form.cleaned_data["email"]
            user.set_unusable_password()
            user.save()
            return complete(request, "email")
    else:
        form = ResetForm()

    return render_to_response(
        "accounts/reset.html", RequestContext(request, {"title": _("Password reset"), "form": form})
    )
开发者ID:spc-12,项目名称:weblate,代码行数:17,代码来源:views.py


示例15: reset_password

def reset_password(request):
    """
    Password reset handling.
    """
    if request.method == "POST":
        form = ResetForm(request.POST)
        if form.is_valid():
            user = form.cleaned_data["email"]
            user.set_unusable_password()
            user.save()
            if not request.session.session_key:
                request.session.create()
            request.session["password_reset"] = True
            return complete(request, "email")
    else:
        form = ResetForm()

    return render(request, "accounts/reset.html", {"title": _("Password reset"), "form": form})
开发者ID:josben77,项目名称:weblate,代码行数:18,代码来源:views.py


示例16: email_login

def email_login(request):
    '''
    Connect email.
    '''
    if request.method == 'POST':
        form = EmailForm(request.POST)
        if form.is_valid():
            return complete(request, 'email')
    else:
        form = EmailForm()

    return render(
        request,
        'accounts/email.html',
        {
            'title': _('Register email'),
            'form': form,
        }
    )
开发者ID:blockgiven,项目名称:weblate,代码行数:19,代码来源:views.py


示例17: register

def register(request):
    '''
    Registration form.
    '''
    if appsettings.REGISTRATION_CAPTCHA:
        form_class = CaptchaRegistrationForm
    else:
        form_class = RegistrationForm

    if request.method == 'POST':
        form = form_class(request.POST)
        if form.is_valid() and appsettings.REGISTRATION_OPEN:
            # Ensure we do registration in separate session
            # not sent to client
            request.session.create()
            result = complete(request, 'email')
            request.session.save()
            request.session = None
            return result
    else:
        form = form_class()

    backends = set(load_backends(BACKENDS).keys())

    # Redirect if there is only one backend
    if len(backends) == 1 and 'email' not in backends:
        return redirect('social:begin', backends.pop())

    return render(
        request,
        'accounts/register.html',
        {
            'registration_email': 'email' in backends,
            'registration_backends': backends - set(['email']),
            'title': _('User registration'),
            'form': form,
        }
    )
开发者ID:Yixf-Self,项目名称:weblate,代码行数:38,代码来源:views.py


示例18: register

def register(request):
    """
    Registration form.
    """
    if appsettings.REGISTRATION_CAPTCHA:
        form_class = CaptchaRegistrationForm
    else:
        form_class = RegistrationForm

    if request.method == "POST":
        form = form_class(request.POST)
        if form.is_valid() and appsettings.REGISTRATION_OPEN:
            # Ensure we do registration in separate session
            # not sent to client
            request.session.create()
            result = complete(request, "email")
            request.session.save()
            request.session = None
            return result
    else:
        form = form_class()

    backends = set(load_backends(BACKENDS).keys())

    # Redirect if there is only one backend
    if len(backends) == 1 and "email" not in backends:
        return redirect("social:begin", backends.pop())

    return render(
        request,
        "accounts/register.html",
        {
            "registration_email": "email" in backends,
            "registration_backends": backends - set(["email"]),
            "title": _("User registration"),
            "form": form,
        },
    )
开发者ID:dtschan,项目名称:weblate,代码行数:38,代码来源:views.py


示例19: get

 def get(self, request, backend, *args, **kwargs):
     return complete(request, backend, *args, **kwargs)
开发者ID:dpanov,项目名称:obshtestvo.bg,代码行数:2,代码来源:entry.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.load_backends函数代码示例发布时间:2022-05-27
下一篇:
Python utils.load_strategy函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap