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
e7dc39fb
Kaydet (Commit)
e7dc39fb
authored
May 22, 2017
tarafından
Mikhail Golubev
Kaydeden (comit)
Tim Graham
Haz 13, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #28229 -- Fixed the value of LoginView's "next" template variable.
üst
a118287b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
5 deletions
+13
-5
views.py
django/contrib/auth/views.py
+7
-5
1.11.3.txt
docs/releases/1.11.3.txt
+5
-0
test_views.py
tests/auth_tests/test_views.py
+1
-0
No files found.
django/contrib/auth/views.py
Dosyayı görüntüle @
e7dc39fb
...
...
@@ -65,7 +65,11 @@ class LoginView(SuccessURLAllowedHostsMixin, FormView):
return
super
()
.
dispatch
(
request
,
*
args
,
**
kwargs
)
def
get_success_url
(
self
):
"""Ensure the user-originating redirection URL is safe."""
url
=
self
.
get_redirect_url
()
return
url
or
resolve_url
(
settings
.
LOGIN_REDIRECT_URL
)
def
get_redirect_url
(
self
):
"""Return the user-originating redirect URL if it's safe."""
redirect_to
=
self
.
request
.
POST
.
get
(
self
.
redirect_field_name
,
self
.
request
.
GET
.
get
(
self
.
redirect_field_name
,
''
)
...
...
@@ -75,9 +79,7 @@ class LoginView(SuccessURLAllowedHostsMixin, FormView):
allowed_hosts
=
self
.
get_success_url_allowed_hosts
(),
require_https
=
self
.
request
.
is_secure
(),
)
if
not
url_is_safe
:
return
resolve_url
(
settings
.
LOGIN_REDIRECT_URL
)
return
redirect_to
return
redirect_to
if
url_is_safe
else
''
def
get_form_class
(
self
):
return
self
.
authentication_form
or
self
.
form_class
...
...
@@ -96,7 +98,7 @@ class LoginView(SuccessURLAllowedHostsMixin, FormView):
context
=
super
()
.
get_context_data
(
**
kwargs
)
current_site
=
get_current_site
(
self
.
request
)
context
.
update
({
self
.
redirect_field_name
:
self
.
get_
success
_url
(),
self
.
redirect_field_name
:
self
.
get_
redirect
_url
(),
'site'
:
current_site
,
'site_name'
:
current_site
.
name
,
})
...
...
docs/releases/1.11.3.txt
Dosyayı görüntüle @
e7dc39fb
...
...
@@ -35,3 +35,8 @@ Bugfixes
* Prevented ``Paginator``’s unordered object list warning from evaluating a
``QuerySet`` (:ticket:`28284`).
* Fixed the value of ``redirect_field_name`` in ``LoginView``’s template
context. It's now an empty string (as it is for the original function-based
``login()`` view) if the corresponding parameter isn't sent in a request (in
particular, when the login page is accessed directly) (:ticket:`28229`).
tests/auth_tests/test_views.py
Dosyayı görüntüle @
e7dc39fb
...
...
@@ -835,6 +835,7 @@ class LoginRedirectAuthenticatedUser(AuthViewsTestCase):
self
.
login
()
response
=
self
.
client
.
get
(
self
.
dont_redirect_url
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
context
[
'next'
],
''
)
def
test_guest
(
self
):
"""If not logged in, stay on the same page."""
...
...
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