當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。