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
34f4fd70
Kaydet (Commit)
34f4fd70
authored
Haz 10, 2014
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Corrected some indentation in docs/topics/auth/default.txt.
üst
9560dac3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
36 deletions
+36
-36
default.txt
docs/topics/auth/default.txt
+36
-36
No files found.
docs/topics/auth/default.txt
Dosyayı görüntüle @
34f4fd70
...
@@ -1099,12 +1099,12 @@ patterns.
...
@@ -1099,12 +1099,12 @@ patterns.
* ``template_name``: The full name of a template to display the view.
* ``template_name``: The full name of a template to display the view.
Defaults to :file:`registration/password_reset_complete.html`.
Defaults to :file:`registration/password_reset_complete.html`.
* ``current_app``: A hint indicating which application contains the current
* ``current_app``: A hint indicating which application contains the current
view. See the :ref:`namespaced URL resolution strategy
view. See the :ref:`namespaced URL resolution strategy
<topics-http-reversing-url-namespaces>` for more information.
<topics-http-reversing-url-namespaces>` for more information.
* ``extra_context``: A dictionary of context data that will be added to the
* ``extra_context``: A dictionary of context data that will be added to the
default context data passed to the template.
default context data passed to the template.
Helper functions
Helper functions
----------------
----------------
...
@@ -1164,37 +1164,37 @@ provides several built-in forms located in :mod:`django.contrib.auth.forms`:
...
@@ -1164,37 +1164,37 @@ provides several built-in forms located in :mod:`django.contrib.auth.forms`:
.. method:: confirm_login_allowed(user)
.. method:: confirm_login_allowed(user)
.. versionadded:: 1.7
.. versionadded:: 1.7
By default, ``AuthenticationForm`` rejects users whose ``is_active`` flag
By default, ``AuthenticationForm`` rejects users whose ``is_active`` flag
is set to ``False``. You may override this behavior with a custom policy to
is set to ``False``. You may override this behavior with a custom policy to
determine which users can log in. Do this with a custom form that subclasses
determine which users can log in. Do this with a custom form that subclasses
``AuthenticationForm`` and overrides the ``confirm_login_allowed`` method.
``AuthenticationForm`` and overrides the ``confirm_login_allowed`` method.
This method should raise a :exc:`~django.core.exceptions.ValidationError`
This method should raise a :exc:`~django.core.exceptions.ValidationError`
if the given user may not log in.
if the given user may not log in.
For example, to allow all users to log in, regardless of "active" status::
For example, to allow all users to log in, regardless of "active" status::
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.forms import AuthenticationForm
class AuthenticationFormWithInactiveUsersOkay(AuthenticationForm):
class AuthenticationFormWithInactiveUsersOkay(AuthenticationForm):
def confirm_login_allowed(self, user):
def confirm_login_allowed(self, user):
pass
pass
Or to allow only some active users to log in::
Or to allow only some active users to log in::
class PickyAuthenticationForm(AuthenticationForm):
class PickyAuthenticationForm(AuthenticationForm):
def confirm_login_allowed(self, user):
def confirm_login_allowed(self, user):
if not user.is_active:
if not user.is_active:
raise forms.ValidationError(
raise forms.ValidationError(
_("This account is inactive."),
_("This account is inactive."),
code='inactive',
code='inactive',
)
)
if user.username.startswith('b'):
if user.username.startswith('b'):
raise forms.ValidationError(
raise forms.ValidationError(
_("Sorry, accounts starting with 'b' aren't welcome here."),
_("Sorry, accounts starting with 'b' aren't welcome here."),
code='no_b_users',
code='no_b_users',
)
)
.. class:: PasswordChangeForm
.. class:: PasswordChangeForm
...
...
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