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


Python views.complete函数代码示例

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


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


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