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


Python views.password_reset_confirm方法代码示例

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


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

示例1: do_view

# 需要导入模块: from django.contrib.auth import views [as 别名]
# 或者: from django.contrib.auth.views import password_reset_confirm [as 别名]
def do_view(self, request, uidb36, token, *args, **kwargs):
        context = super(ResetPasswordComfirmView, self).get_context()
        return password_reset_confirm(request, uidb36, token,
                   template_name=self.password_reset_confirm_template,
                   token_generator=self.password_reset_token_generator,
                   set_password_form=self.password_reset_set_form,
                   post_reset_redirect=self.get_admin_url('xadmin_password_reset_complete'),
                   current_app=self.admin_site.name, extra_context=context) 
开发者ID:stormsha,项目名称:StormOnline,代码行数:10,代码来源:passwords.py

示例2: password_reset_confirm

# 需要导入模块: from django.contrib.auth import views [as 别名]
# 或者: from django.contrib.auth.views import password_reset_confirm [as 别名]
def password_reset_confirm(request, uidb64, token, template_name):
    try:
        uid = urlsafe_base64_decode(uidb64)
        user = User.objects.get(pk=uid)
    except(TypeError, ValueError, OverflowError, User.DoesNotExist):
        user = None
    accounts_with_transfer_code = 0
    if user is not None:
        accounts_with_transfer_code = user.accounts_set.exclude(transfer_code__isnull=True).exclude(transfer_code__exact='').count()

    response = password_reset_confirm_view(request, uidb64=uidb64, token=token, extra_context={'accounts_with_transfer_code': accounts_with_transfer_code}, template_name=template_name)
    if isinstance(response, HttpResponseRedirect) and user is not None:
        accounts_with_transfer_code = user.accounts_set.all().update(transfer_code='')
    return response 
开发者ID:MagiCircles,项目名称:SchoolIdolAPI,代码行数:16,代码来源:views.py

示例3: password_reset_confirm

# 需要导入模块: from django.contrib.auth import views [as 别名]
# 或者: from django.contrib.auth.views import password_reset_confirm [as 别名]
def password_reset_confirm(request, uidb64, token):
    u"""Landing page for password reset."""
    return auth_views.password_reset_confirm(
        request,
        uidb64,
        token,
        template_name='auth/password_reset_confirm.html',
        post_reset_redirect='login',
    ) 
开发者ID:stxnext-csr,项目名称:volontulo,代码行数:11,代码来源:auth.py

示例4: test_password_reset_confirm_url_and_template

# 需要导入模块: from django.contrib.auth import views [as 别名]
# 或者: from django.contrib.auth.views import password_reset_confirm [as 别名]
def test_password_reset_confirm_url_and_template(self):
        self.check_url('/accounts/password/reset/MMMM/fjdklafjsl/',
                       auth_views.password_reset_confirm)
        response = self.client.post(reverse(
            'accounts:password-reset-confirm',
            kwargs={
                'uidb64': 'MMM',
                'token': 'fsaljfkdl'
            }))
        self.assertTemplateUsed(response,
                                'accounts/password_reset_confirm.html') 
开发者ID:nlhkabu,项目名称:connect,代码行数:13,代码来源:test_views.py

示例5: forgot_passwd_check

# 需要导入模块: from django.contrib.auth import views [as 别名]
# 或者: from django.contrib.auth.views import password_reset_confirm [as 别名]
def forgot_passwd_check(request, uidb64=None, token=None):
    """
    Page that checks the hash in a password reset link, generates a new password which is send via SMS to the user.
    """
    assert uidb64 is not None and token is not None
    dc1_settings = DefaultDc().settings
    sms_registration = dc1_settings.SMS_REGISTRATION_ENABLED

    if sms_registration:
        set_password_form = SMSSendPasswordResetForm
    else:
        set_password_form = PasswordResetForm

    if request.method == 'POST':
        try:
            user = User.objects.get(id=urlsafe_base64_decode(uidb64))
            profile = user.userprofile
        except (ValueError, OverflowError, User.DoesNotExist):
            profile = None

        if profile and profile.email_token == token:
            # Email address is verified, we cant compare to token as register token is different to reset one.
            profile.email_token = ''
            profile.email_verified = True
            # This may look strange - setting the phone_verified before the user logs in. It is not :) We are sending
            # new password to phone number in profile, after the user logs in we would set phone_verified to True anyway
            if sms_registration:
                profile.phone_verified = True
            profile.save()

    return password_reset_confirm(
        request,
        uidb64=uidb64,
        token=token,
        template_name='gui/accounts/forgot_check.html',
        set_password_form=set_password_form,
        post_reset_redirect=reverse('forgot_check_done'),
        current_app='gui',
        extra_context={
            'sms_registration': sms_registration,
        }
    ) 
开发者ID:erigones,项目名称:esdc-ce,代码行数:44,代码来源:views.py


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