Python django.contrib.auth.views 模块,password_reset_confirm() 实例源码

我们从Python开源项目中,提取了以下24个代码示例,用于说明如何使用django.contrib.auth.views.password_reset_confirm()

项目:tumanov_castleoaks    作者:Roamdev    | 项目源码 | 文件源码
def get(self, request, uidb64=None, token=None):
        if request.user.is_authenticated():
            return redirect(get_redirect_url(request))

        # Seo
        seo = Seo()
        seo.title = _('Password reset')
        seo.save(request)

        try:
            uid = urlsafe_base64_decode(uidb64)
            user = UserModel._default_manager.get(pk=uid)
        except (TypeError, ValueError, OverflowError, ObjectDoesNotExist):
            user = None

        if user is None or not default_token_generator.check_token(user, token):
            return redirect(resolve_url(settings.RESET_PASSWORD_REDIRECT_URL))

        return password_reset_confirm(request,
            uidb64=uidb64,
            token=token,
            template_name='users/reset_confirm.html',
            set_password_form=SetPasswordForm,
            post_reset_redirect='users:reset_complete',
        )
项目:munch-core    作者:crunchmail    | 项目源码 | 文件源码
def password_reset_confirm(request, initial=False, extra_context={}, **kwargs):
    extra_context.update({
        'password_policy': password_validators_help_text_html()})

    response = auth_views.password_reset_confirm(
        request, extra_context=extra_context, **kwargs)

    if isinstance(
            response, HttpResponseRedirect) and response.status_code == 302:
        # Send password change confirmation email
        try:
            uid = force_text(urlsafe_base64_decode(kwargs['uidb64']))
            user = MunchUser.objects.get(pk=uid)
            if initial:
                user.send_invitation_complete_email()
            else:
                user.send_password_reset_complete_email()
        except (TypeError, ValueError, OverflowError, MunchUser.DoesNotExist):
            pass
    return response
项目:blog_django    作者:chnpmy    | 项目源码 | 文件源码
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)
项目:dream_blog    作者:fanlion    | 项目源码 | 文件源码
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)
项目:MxOnline    作者:myTeemo    | 项目源码 | 文件源码
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)
项目:djangoblog    作者:liuhuipy    | 项目源码 | 文件源码
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)
项目:sdining    作者:Lurance    | 项目源码 | 文件源码
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)
项目:tumanov_castleoaks    作者:Roamdev    | 项目源码 | 文件源码
def post(self, request, uidb64=None, token=None):
        # Seo
        seo = Seo()
        seo.title = _('Password reset')
        seo.save(request)

        if request.user.is_authenticated():
            # ????? ?????? ??????, ???? ????????????
            form = SetPasswordForm(request.user, request.POST)
            if form.is_valid():
                form.save()
                return redirect(get_redirect_url(request, 'users:reset_complete'))
            else:
                return self.render_to_response({
                    'form': form,
                })
        else:
            if uidb64 is None or token is None:
                return redirect(resolve_url(settings.RESET_PASSWORD_REDIRECT_URL))

            return password_reset_confirm(request,
                uidb64=uidb64,
                token=token,
                template_name='users/reset_confirm.html',
                set_password_form=SetPasswordForm,
                post_reset_redirect='users:reset_complete',
            )
项目:xadmin-markdown-editor    作者:bluenknight    | 项目源码 | 文件源码
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)
项目:esdc-ce    作者:erigones    | 项目源码 | 文件源码
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

    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.
        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=PasswordResetForm,
        post_reset_redirect=reverse('forgot_check_done'),
        current_app='gui')
项目:YouPBX    作者:JoneXiong    | 项目源码 | 文件源码
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)
项目:studentsdb    作者:PyDev777    | 项目源码 | 文件源码
def custom_password_reset_confirm(request, uidb64=None, token=None):
    if request.is_ajax():
        return auth_view.password_reset_confirm(request, uidb64, token, set_password_form=CustSetPswForm)
    else:
        return render(request, 'registration/form_redirect.html', {'form_url': request.build_absolute_uri()})
项目:eduDjango    作者:yuzhou6    | 项目源码 | 文件源码
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)
项目:Django-IMOOC-Shop    作者:LBruse    | 项目源码 | 文件源码
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)
项目:StudyOnline    作者:yipwinghong    | 项目源码 | 文件源码
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)
项目:xadmin_python3    作者:mahongquan    | 项目源码 | 文件源码
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)
项目:Django-shop    作者:poetries    | 项目源码 | 文件源码
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)
项目:MoocOnline    作者:My-captain    | 项目源码 | 文件源码
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)
项目:followme    作者:wzqnls    | 项目源码 | 文件源码
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)
项目:mxonline    作者:huwei86    | 项目源码 | 文件源码
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)
项目:mes    作者:osess    | 项目源码 | 文件源码
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)
项目:Charlotte    作者:LiZoRN    | 项目源码 | 文件源码
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)
项目:imooc-django    作者:zaxlct    | 项目源码 | 文件源码
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)
项目:muxueonline    作者:124608760    | 项目源码 | 文件源码
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)