Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
f1761e3f
Kaydet (Commit)
f1761e3f
authored
Eyl 01, 2015
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #21648 -- Removed is_admin_site option from password_reset() view.
Per deprecation timeline.
üst
fd6a299c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
36 deletions
+4
-36
views.py
django/contrib/auth/views.py
+2
-12
default.txt
docs/topics/auth/default.txt
+1
-6
test_views.py
tests/auth_tests/test_views.py
+1
-17
urls.py
tests/auth_tests/urls.py
+0
-1
No files found.
django/contrib/auth/views.py
Dosyayı görüntüle @
f1761e3f
...
...
@@ -17,9 +17,7 @@ from django.core.urlresolvers import reverse
from
django.http
import
HttpResponseRedirect
,
QueryDict
from
django.shortcuts
import
resolve_url
from
django.template.response
import
TemplateResponse
from
django.utils.deprecation
import
(
RemovedInDjango20Warning
,
RemovedInDjango110Warning
,
)
from
django.utils.deprecation
import
RemovedInDjango20Warning
from
django.utils.encoding
import
force_text
from
django.utils.http
import
is_safe_url
,
urlsafe_base64_decode
from
django.utils.six.moves.urllib.parse
import
urlparse
,
urlunparse
...
...
@@ -166,7 +164,7 @@ def redirect_to_login(next, login_url=None,
@deprecate_current_app
@csrf_protect
def
password_reset
(
request
,
is_admin_site
=
False
,
def
password_reset
(
request
,
template_name
=
'registration/password_reset_form.html'
,
email_template_name
=
'registration/password_reset_email.html'
,
subject_template_name
=
'registration/password_reset_subject.txt'
,
...
...
@@ -194,14 +192,6 @@ def password_reset(request, is_admin_site=False,
'html_email_template_name'
:
html_email_template_name
,
'extra_email_context'
:
extra_email_context
,
}
if
is_admin_site
:
warnings
.
warn
(
"The is_admin_site argument to "
"django.contrib.auth.views.password_reset() is deprecated "
"and will be removed in Django 1.10."
,
RemovedInDjango110Warning
,
3
)
opts
=
dict
(
opts
,
domain_override
=
request
.
get_host
())
form
.
save
(
**
opts
)
return
HttpResponseRedirect
(
post_reset_redirect
)
else
:
...
...
docs/topics/auth/default.txt
Dosyayı görüntüle @
f1761e3f
...
...
@@ -1219,7 +1219,7 @@ implementation details see :ref:`using-the-views`.
The ``current_app`` parameter is deprecated and will be removed in
Django 2.0. Callers should set ``request.current_app`` instead.
.. function:: password_reset(request,
is_admin_site=False,
template_name='registration/password_reset_form.html', email_template_name='registration/password_reset_email.html', subject_template_name='registration/password_reset_subject.txt', password_reset_form=PasswordResetForm, token_generator=default_token_generator, post_reset_redirect=None, from_email=None, current_app=None, extra_context=None, html_email_template_name=None, extra_email_context=None)
.. function:: password_reset(request, template_name='registration/password_reset_form.html', email_template_name='registration/password_reset_email.html', subject_template_name='registration/password_reset_subject.txt', password_reset_form=PasswordResetForm, token_generator=default_token_generator, post_reset_redirect=None, from_email=None, current_app=None, extra_context=None, html_email_template_name=None, extra_email_context=None)
Allows a user to reset their password by generating a one-time use link
that can be used to reset the password, and sending that link to the
...
...
@@ -1283,11 +1283,6 @@ implementation details see :ref:`using-the-views`.
* ``extra_email_context``: A dictionary of context data that will available
in the email template.
.. deprecated:: 1.8
The ``is_admin_site`` argument is deprecated and will be removed in
Django 1.10.
.. deprecated:: 1.9
The ``current_app`` parameter is deprecated and will be removed in
...
...
tests/auth_tests/test_views.py
Dosyayı görüntüle @
f1761e3f
...
...
@@ -24,11 +24,8 @@ from django.core.urlresolvers import NoReverseMatch, reverse, reverse_lazy
from
django.db
import
connection
from
django.http
import
HttpRequest
,
QueryDict
from
django.middleware.csrf
import
CsrfViewMiddleware
,
get_token
from
django.test
import
(
TestCase
,
ignore_warnings
,
modify_settings
,
override_settings
,
)
from
django.test
import
TestCase
,
modify_settings
,
override_settings
from
django.test.utils
import
patch_logger
from
django.utils.deprecation
import
RemovedInDjango110Warning
from
django.utils.encoding
import
force_text
from
django.utils.http
import
urlquote
from
django.utils.six.moves.urllib.parse
import
ParseResult
,
urlparse
...
...
@@ -209,19 +206,6 @@ class PasswordResetTest(AuthViewsTestCase):
self
.
assertEqual
(
len
(
mail
.
outbox
),
1
)
self
.
assertEqual
(
"staffmember@example.com"
,
mail
.
outbox
[
0
]
.
from_email
)
@ignore_warnings
(
category
=
RemovedInDjango110Warning
)
@override_settings
(
ALLOWED_HOSTS
=
[
'adminsite.com'
])
def
test_admin_reset
(
self
):
"If the reset view is marked as being for admin, the HTTP_HOST header is used for a domain override."
response
=
self
.
client
.
post
(
'/admin_password_reset/'
,
{
'email'
:
'staffmember@example.com'
},
HTTP_HOST
=
'adminsite.com'
)
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
len
(
mail
.
outbox
),
1
)
self
.
assertIn
(
"http://adminsite.com"
,
mail
.
outbox
[
0
]
.
body
)
self
.
assertEqual
(
settings
.
DEFAULT_FROM_EMAIL
,
mail
.
outbox
[
0
]
.
from_email
)
# Skip any 500 handler action (like sending more mail...)
@override_settings
(
DEBUG_PROPAGATE_EXCEPTIONS
=
True
)
def
test_poisoned_http_host
(
self
):
...
...
tests/auth_tests/urls.py
Dosyayı görüntüle @
f1761e3f
...
...
@@ -85,7 +85,6 @@ urlpatterns = auth_urlpatterns + [
dict
(
post_reset_redirect
=
'password_reset'
)),
url
(
r'^password_change/custom/$'
,
views
.
password_change
,
dict
(
post_change_redirect
=
'/custom/'
)),
url
(
r'^password_change/custom/named/$'
,
views
.
password_change
,
dict
(
post_change_redirect
=
'password_reset'
)),
url
(
r'^admin_password_reset/$'
,
views
.
password_reset
,
dict
(
is_admin_site
=
True
)),
url
(
r'^login_required/$'
,
login_required
(
views
.
password_reset
)),
url
(
r'^login_required_login_url/$'
,
login_required
(
views
.
password_reset
,
login_url
=
'/somewhere/'
)),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment