Changeset 3885
- Timestamp:
- 09/29/06 20:21:03 (2 years ago)
- Files:
-
- django/trunk/AUTHORS (modified) (1 diff)
- django/trunk/django/contrib/auth/models.py (modified) (1 diff)
- django/trunk/docs/authentication.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/AUTHORS
r3872 r3885 76 76 Andy Dustman <farcepest@gmail.com> 77 77 Clint Ecker 78 Enrico <rico.bl@gmail.com> 78 79 favo@exoweb.net 79 80 gandalf@owca.info django/trunk/django/contrib/auth/models.py
r3681 r3885 217 217 def has_module_perms(self, app_label): 218 218 "Returns True if the user has any permissions in the given app label." 219 if not self.is_active: 220 return False 219 221 if self.is_superuser: 220 222 return True django/trunk/docs/authentication.txt
r3884 r3885 100 100 101 101 * ``is_authenticated()`` -- Always returns ``True``. This is a way to 102 tell if the user has been authenticated. 102 tell if the user has been authenticated. This does not imply any 103 permissions, and doesn't check if the user is active - it only indicates 104 that the user has provided a valid username and password. 103 105 104 106 * ``get_full_name()`` -- Returns the ``first_name`` plus the ``last_name``, … … 121 123 * ``has_perm(perm)`` -- Returns ``True`` if the user has the specified 122 124 permission, where perm is in the format ``"package.codename"``. 125 If the user is inactive, this method will always return ``False``. 123 126 124 127 * ``has_perms(perm_list)`` -- Returns ``True`` if the user has each of the 125 128 specified permissions, where each perm is in the format 126 ``"package.codename"``. 129 ``"package.codename"``. If the user is inactive, this method will 130 always return ``False``. 127 131 128 132 * ``has_module_perms(package_name)`` -- Returns ``True`` if the user has 129 133 any permissions in the given package (the Django app label). 134 If the user is inactive, this method will always return ``False``. 130 135 131 136 * ``get_and_delete_messages()`` -- Returns a list of ``Message`` objects in … … 284 289 user = authenticate(username='john', password='secret') 285 290 if user is not None: 286 print "You provided a correct username and password!" 291 if user.is_active: 292 print "You provided a correct username and password!" 293 else: 294 print "Your account has been disabled!" 287 295 else: 288 296 print "Your username and password were incorrect." … … 302 310 user = authenticate(username=username, password=password) 303 311 if user is not None: 304 login(request, user) 305 # Redirect to a success page. 312 if user.is_active: 313 login(request, user) 314 # Redirect to a success page. 315 else: 316 # Return a 'disabled account' error message 306 317 else: 307 # Return a nerror message.318 # Return a 'invalid login' error message. 308 319 309 320 How to log a user out
