├── .hgignore ├── .hgtags ├── LICENSE ├── MANIFEST.in ├── README.rst ├── django_bcrypt ├── __init__.py ├── models.py └── tests.py ├── docs ├── Makefile ├── source │ ├── conf.py │ └── index.rst └── themes │ └── waiter │ ├── layout.html │ ├── static │ └── rtd.css │ └── theme.conf └── setup.py /.hgignore: -------------------------------------------------------------------------------- 1 | syntax: glob 2 | 3 | *.pyc 4 | .DS_Store 5 | .project 6 | .pydevproject 7 | *.swp 8 | *.un~ 9 | 10 | syntax: regexp 11 | ^build$ 12 | ^dist$ 13 | ^django_bcrypt.egg-info$ 14 | docs/build 15 | -------------------------------------------------------------------------------- /.hgtags: -------------------------------------------------------------------------------- 1 | 968905bf10032052d82186ec3ec91d4d7da1a043 v0.9.0 2 | 0795d21d5d1236c8b907d05f4a2c5d549941721f semver 3 | 8e6510cf2c146ff78ec6d311c7c8666257f890a3 v0.9.2 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 Dumbwaiter Design 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include LICENSE 2 | include README.rst 3 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | django-bcrypt 2 | ============= 3 | 4 | `You should be using bcrypt`_. 5 | 6 | .. _You should be using bcrypt: 7 | http://codahale.com/how-to-safely-store-a-password/ 8 | 9 | django-bcrypt makes it easy to use bcrypt to hash passwords with Django. 10 | 11 | * **Mercurial:** http://bitbucket.org/dwaiter/django-bcrypt/ 12 | * **Git:** http://github.com/dwaiter/django-bcrypt/ 13 | * **Documentation:** http://django-bcrypt.rtfd.org/ 14 | * **Issues:** http://bitbucket.org/dwaiter/django-bcrypt/issues?status=new&status=open 15 | 16 | Installation and Usage 17 | ---------------------- 18 | 19 | Install the package with `pip`_ and `Mercurial`_ or `git`_:: 20 | 21 | pip install -e hg+http://bitbucket.org/dwaiter/django-bcrypt#egg=django-bcrypt 22 | 23 | # or ... 24 | 25 | pip install -e git://github.com/dwaiter/django-bcrypt.git#egg=django-bcrypt 26 | 27 | .. _pip: http://pip.openplans.org/ 28 | .. _Mercurial: http://hg-scm.org/ 29 | .. _git: http://git-scm.com/ 30 | 31 | Add ``django_bcrypt`` to your ``INSTALLED_APPS``. 32 | 33 | That's it. 34 | 35 | Any new passwords set will be hashed with bcrypt. Old passwords will still work 36 | fine. 37 | 38 | 39 | Configuration 40 | ------------- 41 | 42 | You can configure how django-bcrypt behaves with a few settings in your 43 | ``settings.py`` file. 44 | 45 | ``BCRYPT_ENABLED`` 46 | `````````````````` 47 | 48 | Enables bcrypt hashing when ``User.set_password()`` is called. 49 | 50 | Default: ``True`` 51 | 52 | ``BCRYPT_ENABLED_UNDER_TEST`` 53 | ````````````````````````````` 54 | 55 | Enables bcrypt hashing when running inside Django TestCases. 56 | 57 | Default: ``False`` (to speed up user creation) 58 | 59 | ``BCRYPT_ROUNDS`` 60 | ````````````````` 61 | 62 | Number of rounds to use for bcrypt hashing. Increase this as computers get faster. 63 | 64 | You can change the number of rounds without breaking already-hashed passwords. New 65 | passwords will use the new number of rounds, and old ones will use the old number. 66 | 67 | Default: ``12`` 68 | 69 | ``BCRYPT_MIGRATE`` 70 | `````````````````` 71 | 72 | Enables bcrypt password migration on a ``check_password()`` call. 73 | 74 | The hash is also migrated when ``BCRYPT_ROUNDS`` changes. 75 | 76 | Default: ``False`` 77 | 78 | 79 | Acknowledgements 80 | ---------------- 81 | 82 | This is pretty much a packaged-up version of `this blog post`_ for easier use. 83 | 84 | It also depends on the `py-bcrypt`_ library. 85 | 86 | .. _this blog post: 87 | http://kfalck.net/2010/12/27/blogi-linodessa-ja-bcrypt-kaytossa 88 | 89 | .. _py-bcrypt: 90 | http://www.mindrot.org/projects/py-bcrypt/ 91 | 92 | -------------------------------------------------------------------------------- /django_bcrypt/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dwaiter/django-bcrypt/913d86b2ba71334fd54670c6f0050bec02689654/django_bcrypt/__init__.py -------------------------------------------------------------------------------- /django_bcrypt/models.py: -------------------------------------------------------------------------------- 1 | """ 2 | In Django 1.4+, simply adds itself to the PASSWORD_HASHERS setting so old 3 | passwords will be converted properly. 4 | 5 | Otherwise, overrides :class:`django.contrib.auth.models.User` to use bcrypt 6 | hashing for passwords. 7 | 8 | You can set the following ``settings``: 9 | 10 | ``BCRYPT_ENABLED`` 11 | Enables bcrypt hashing when ``User.set_password()`` is called. 12 | 13 | ``BCRYPT_ENABLED_UNDER_TEST`` 14 | Enables bcrypt hashing when running inside Django 15 | TestCases. Defaults to False, to speed up user creation. 16 | 17 | ``BCRYPT_ROUNDS`` 18 | Number of rounds to use for bcrypt hashing. Defaults to 12. 19 | 20 | ``BCRYPT_MIGRATE`` 21 | Enables bcrypt password migration on a check_password() call. 22 | Default is set to False. 23 | """ 24 | 25 | 26 | import bcrypt 27 | 28 | from django.contrib.auth.models import User 29 | from django.conf import settings 30 | from django.core import mail 31 | from django.utils.encoding import smart_str 32 | 33 | 34 | def get_rounds(): 35 | """Returns the number of rounds to use for bcrypt hashing.""" 36 | return getattr(settings, "BCRYPT_ROUNDS", 12) 37 | 38 | 39 | def is_enabled(): 40 | """Returns ``True`` if bcrypt should be used.""" 41 | enabled = getattr(settings, "BCRYPT_ENABLED", True) 42 | if not enabled: 43 | return False 44 | # Are we under a test? 45 | if hasattr(mail, 'outbox'): 46 | return getattr(settings, "BCRYPT_ENABLED_UNDER_TEST", False) 47 | return True 48 | 49 | 50 | def migrate_to_bcrypt(): 51 | """Returns ``True`` if password migration is activated.""" 52 | return getattr(settings, "BCRYPT_MIGRATE", False) 53 | 54 | 55 | def bcrypt_check_password(self, raw_password): 56 | """ 57 | Returns a boolean of whether the *raw_password* was correct. 58 | 59 | Attempts to validate with bcrypt, but falls back to Django's 60 | ``User.check_password()`` if the hash is incorrect. 61 | 62 | If ``BCRYPT_MIGRATE`` is set, attempts to convert sha1 password to bcrypt 63 | or converts between different bcrypt rounds values. 64 | 65 | .. note:: 66 | 67 | In case of a password migration this method calls ``User.save()`` to 68 | persist the changes. 69 | """ 70 | pwd_ok = False 71 | should_change = False 72 | if self.password.startswith('bc$'): 73 | salt_and_hash = self.password[3:] 74 | pwd_ok = bcrypt.hashpw(smart_str(raw_password), salt_and_hash) == salt_and_hash 75 | if pwd_ok: 76 | rounds = int(salt_and_hash.split('$')[2]) 77 | should_change = rounds != get_rounds() 78 | elif _check_password(self, raw_password): 79 | pwd_ok = True 80 | should_change = True 81 | 82 | if pwd_ok and should_change and is_enabled() and migrate_to_bcrypt(): 83 | self.set_password(raw_password) 84 | salt_and_hash = self.password[3:] 85 | assert bcrypt.hashpw(raw_password, salt_and_hash) == salt_and_hash 86 | self.save() 87 | 88 | return pwd_ok 89 | 90 | 91 | def bcrypt_set_password(self, raw_password): 92 | """ 93 | Sets the user's password to *raw_password*, hashed with bcrypt. 94 | """ 95 | if not is_enabled() or raw_password is None: 96 | _set_password(self, raw_password) 97 | else: 98 | salt = bcrypt.gensalt(get_rounds()) 99 | self.password = 'bc$' + bcrypt.hashpw(smart_str(raw_password), salt) 100 | 101 | 102 | try: 103 | from django.contrib.auth.hashers import BCryptPasswordHasher 104 | 105 | class LegacyDjangoBCryptPasswordHasher(BCryptPasswordHasher): 106 | algorithm = 'bc' 107 | 108 | settings.PASSWORD_HASHERS = settings.PASSWORD_HASHERS + ('django_bcrypt.models.LegacyDjangoBCryptPasswordHasher',) 109 | except ImportError: 110 | _check_password = User.check_password 111 | User.check_password = bcrypt_check_password 112 | _set_password = User.set_password 113 | User.set_password = bcrypt_set_password 114 | -------------------------------------------------------------------------------- /django_bcrypt/tests.py: -------------------------------------------------------------------------------- 1 | from __future__ import with_statement 2 | from contextlib import contextmanager 3 | 4 | import bcrypt 5 | 6 | from django import conf 7 | from django.contrib.auth.models import User, UNUSABLE_PASSWORD 8 | from django.test import TestCase 9 | from django.utils.functional import LazyObject 10 | 11 | from django_bcrypt.models import (bcrypt_check_password, bcrypt_set_password, 12 | _check_password, _set_password, 13 | get_rounds, is_enabled, migrate_to_bcrypt) 14 | 15 | 16 | class CheckPasswordTest(TestCase): 17 | def test_bcrypt_password(self): 18 | user = User() 19 | with settings(): 20 | bcrypt_set_password(user, 'password') 21 | self.assertTrue(bcrypt_check_password(user, 'password')) 22 | self.assertFalse(bcrypt_check_password(user, 'invalid')) 23 | 24 | def test_unicode_password(self): 25 | user = User() 26 | with settings(): 27 | bcrypt_set_password(user, u"aáåäeéêëoôö") 28 | self.assertTrue(bcrypt_check_password(user, u"aaaaeeeeooo")) 29 | self.assertFalse(bcrypt_check_password(user, 'invalid')) 30 | 31 | def test_sha1_password(self): 32 | user = User() 33 | _set_password(user, 'password') 34 | self.assertTrue(bcrypt_check_password(user, 'password')) 35 | self.assertFalse(bcrypt_check_password(user, 'invalid')) 36 | 37 | def test_change_rounds(self): 38 | user = User() 39 | # Hash with 5 rounds 40 | with settings(BCRYPT_ROUNDS=5): 41 | bcrypt_set_password(user, 'password') 42 | password_5 = user.password 43 | self.assertTrue(bcrypt_check_password(user, 'password')) 44 | # Hash with 12 rounds 45 | with settings(BCRYPT_ROUNDS=12): 46 | bcrypt_set_password(user, 'password') 47 | password_12 = user.password 48 | self.assertTrue(bcrypt_check_password(user, 'password')) 49 | 50 | 51 | class SetPasswordTest(TestCase): 52 | def assertBcrypt(self, hashed, password): 53 | self.assertEqual(hashed[:3], 'bc$') 54 | self.assertEqual(hashed[3:], bcrypt.hashpw(password, hashed[3:])) 55 | 56 | def test_set_password(self): 57 | user = User() 58 | with settings(): 59 | bcrypt_set_password(user, 'password') 60 | self.assertBcrypt(user.password, 'password') 61 | 62 | def test_disabled(self): 63 | user = User() 64 | with settings(BCRYPT_ENABLED=False): 65 | bcrypt_set_password(user, 'password') 66 | self.assertFalse(user.password.startswith('bc$'), user.password) 67 | 68 | def test_set_unusable_password(self): 69 | user = User() 70 | with settings(): 71 | bcrypt_set_password(user, None) 72 | self.assertEqual(user.password, UNUSABLE_PASSWORD) 73 | 74 | def test_change_rounds(self): 75 | user = User() 76 | with settings(BCRYPT_ROUNDS=0): 77 | settings.BCRYPT_ROUNDS = 0 78 | bcrypt_set_password(user, 'password') 79 | self.assertBcrypt(user.password, 'password') 80 | 81 | 82 | class MigratePasswordTest(TestCase): 83 | def assertBcrypt(self, hashed, password): 84 | self.assertEqual(hashed[:3], 'bc$') 85 | self.assertEqual(hashed[3:], bcrypt.hashpw(password, hashed[3:])) 86 | 87 | def assertSha1(self, hashed, password): 88 | self.assertEqual(hashed[:5], 'sha1$') 89 | 90 | def test_migrate_sha1_to_bcrypt(self): 91 | user = User(username='username') 92 | with settings(BCRYPT_MIGRATE=True, BCRYPT_ENABLED_UNDER_TEST=True): 93 | _set_password(user, 'password') 94 | self.assertSha1(user.password, 'password') 95 | self.assertTrue(bcrypt_check_password(user, 'password')) 96 | self.assertBcrypt(user.password, 'password') 97 | self.assertEqual(User.objects.get(username='username').password, 98 | user.password) 99 | 100 | def test_migrate_bcrypt_to_bcrypt(self): 101 | user = User(username='username') 102 | with settings(BCRYPT_MIGRATE=True, 103 | BCRYPT_ROUNDS=10, 104 | BCRYPT_ENABLED_UNDER_TEST=True): 105 | user.set_password('password') 106 | with settings(BCRYPT_MIGRATE=True, 107 | BCRYPT_ROUNDS=12, 108 | BCRYPT_ENABLED_UNDER_TEST=True): 109 | user.check_password('password') 110 | salt_and_hash = user.password[3:] 111 | self.assertEqual(salt_and_hash.split('$')[2], '12') 112 | self.assertEqual(User.objects.get(username='username').password, 113 | user.password) 114 | 115 | def test_no_bcrypt_to_bcrypt(self): 116 | user = User(username='username') 117 | with settings(BCRYPT_MIGRATE=True, 118 | BCRYPT_ROUNDS=10, 119 | BCRYPT_ENABLED_UNDER_TEST=True): 120 | user.set_password('password') 121 | old_password = user.password 122 | user.check_password('password') 123 | self.assertEqual(old_password, user.password) 124 | 125 | def test_no_migrate_password(self): 126 | user = User() 127 | with settings(BCRYPT_MIGRATE=False, BCRYPT_ENABLED_UNDER_TEST=True): 128 | _set_password(user, 'password') 129 | self.assertSha1(user.password, 'password') 130 | self.assertTrue(bcrypt_check_password(user, 'password')) 131 | self.assertSha1(user.password, 'password') 132 | 133 | 134 | class SettingsTest(TestCase): 135 | def test_rounds(self): 136 | with settings(BCRYPT_ROUNDS=0): 137 | self.assertEqual(get_rounds(), 0) 138 | with settings(BCRYPT_ROUNDS=5): 139 | self.assertEqual(get_rounds(), 5) 140 | with settings(BCRYPT_ROUNDS=NotImplemented): 141 | self.assertEqual(get_rounds(), 12) 142 | 143 | def test_enabled(self): 144 | with settings(BCRYPT_ENABLED=False): 145 | self.assertFalse(is_enabled()) 146 | with settings(BCRYPT_ENABLED=True): 147 | self.assertTrue(is_enabled()) 148 | with settings(BCRYPT_ENABLED=NotImplemented): 149 | self.assertTrue(is_enabled()) 150 | 151 | def test_enabled_under_test(self): 152 | with settings(BCRYPT_ENABLED_UNDER_TEST=True): 153 | self.assertTrue(is_enabled()) 154 | with settings(BCRYPT_ENABLED_UNDER_TEST=False): 155 | self.assertFalse(is_enabled()) 156 | with settings(BCRYPT_ENABLED_UNDER_TEST=NotImplemented): 157 | self.assertFalse(is_enabled()) 158 | 159 | def test_migrate_to_bcrypt(self): 160 | with settings(BCRYPT_MIGRATE=False): 161 | self.assertEqual(migrate_to_bcrypt(), False) 162 | with settings(BCRYPT_MIGRATE=True): 163 | self.assertEqual(migrate_to_bcrypt(), True) 164 | with settings(BCRYPT_MIGRATE=NotImplemented): 165 | self.assertEqual(migrate_to_bcrypt(), False) 166 | 167 | 168 | def settings(**kwargs): 169 | kwargs = dict({'BCRYPT_ENABLED': True, 170 | 'BCRYPT_ENABLED_UNDER_TEST': True}, 171 | **kwargs) 172 | return patch(conf.settings, **kwargs) 173 | 174 | 175 | @contextmanager 176 | def patch(namespace, **values): 177 | """Patches `namespace`.`name` with `value` for (name, value) in values""" 178 | 179 | originals = {} 180 | 181 | if isinstance(namespace, LazyObject): 182 | if namespace._wrapped is None: 183 | namespace._setup() 184 | namespace = namespace._wrapped 185 | 186 | for (name, value) in values.iteritems(): 187 | try: 188 | originals[name] = getattr(namespace, name) 189 | except AttributeError: 190 | originals[name] = NotImplemented 191 | if value is NotImplemented: 192 | if originals[name] is not NotImplemented: 193 | delattr(namespace, name) 194 | else: 195 | setattr(namespace, name, value) 196 | 197 | try: 198 | yield 199 | finally: 200 | for (name, original_value) in originals.iteritems(): 201 | if original_value is NotImplemented: 202 | if values[name] is not NotImplemented: 203 | delattr(namespace, name) 204 | else: 205 | setattr(namespace, name, original_value) 206 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = build 9 | 10 | # Internal variables. 11 | PAPEROPT_a4 = -D latex_paper_size=a4 12 | PAPEROPT_letter = -D latex_paper_size=letter 13 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source 14 | 15 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest 16 | 17 | help: 18 | @echo "Please use \`make ' where is one of" 19 | @echo " html to make standalone HTML files" 20 | @echo " dirhtml to make HTML files named index.html in directories" 21 | @echo " singlehtml to make a single large HTML file" 22 | @echo " pickle to make pickle files" 23 | @echo " json to make JSON files" 24 | @echo " htmlhelp to make HTML files and a HTML help project" 25 | @echo " qthelp to make HTML files and a qthelp project" 26 | @echo " devhelp to make HTML files and a Devhelp project" 27 | @echo " epub to make an epub" 28 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 29 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 30 | @echo " text to make text files" 31 | @echo " man to make manual pages" 32 | @echo " changes to make an overview of all changed/added/deprecated items" 33 | @echo " linkcheck to check all external links for integrity" 34 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 35 | 36 | clean: 37 | -rm -rf $(BUILDDIR)/* 38 | 39 | html: 40 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 41 | @echo 42 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 43 | 44 | dirhtml: 45 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 46 | @echo 47 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 48 | 49 | singlehtml: 50 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 51 | @echo 52 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 53 | 54 | pickle: 55 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 56 | @echo 57 | @echo "Build finished; now you can process the pickle files." 58 | 59 | json: 60 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 61 | @echo 62 | @echo "Build finished; now you can process the JSON files." 63 | 64 | htmlhelp: 65 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 66 | @echo 67 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 68 | ".hhp project file in $(BUILDDIR)/htmlhelp." 69 | 70 | qthelp: 71 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 72 | @echo 73 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 74 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 75 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/DumbwaiterDesign.qhcp" 76 | @echo "To view the help file:" 77 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/DumbwaiterDesign.qhc" 78 | 79 | devhelp: 80 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 81 | @echo 82 | @echo "Build finished." 83 | @echo "To view the help file:" 84 | @echo "# mkdir -p $$HOME/.local/share/devhelp/DumbwaiterDesign" 85 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/DumbwaiterDesign" 86 | @echo "# devhelp" 87 | 88 | epub: 89 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 90 | @echo 91 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 92 | 93 | latex: 94 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 95 | @echo 96 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 97 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 98 | "(use \`make latexpdf' here to do that automatically)." 99 | 100 | latexpdf: 101 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 102 | @echo "Running LaTeX files through pdflatex..." 103 | make -C $(BUILDDIR)/latex all-pdf 104 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 105 | 106 | text: 107 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 108 | @echo 109 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 110 | 111 | man: 112 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 113 | @echo 114 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 115 | 116 | changes: 117 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 118 | @echo 119 | @echo "The overview file is in $(BUILDDIR)/changes." 120 | 121 | linkcheck: 122 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 123 | @echo 124 | @echo "Link check complete; look for any errors in the above output " \ 125 | "or in $(BUILDDIR)/linkcheck/output.txt." 126 | 127 | doctest: 128 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 129 | @echo "Testing of doctests in the sources finished, look at the " \ 130 | "results in $(BUILDDIR)/doctest/output.txt." 131 | -------------------------------------------------------------------------------- /docs/source/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # django-bcrypt documentation build configuration file, created by 4 | # sphinx-quickstart on Thu May 19 14:06:46 2011. 5 | # 6 | # This file is execfile()d with the current directory set to its containing dir. 7 | # 8 | # Note that not all possible configuration values are present in this 9 | # autogenerated file. 10 | # 11 | # All configuration values have a default; values that are commented out 12 | # serve to show the default. 13 | 14 | import sys, os 15 | 16 | # If extensions (or modules to document with autodoc) are in another directory, 17 | # add these directories to sys.path here. If the directory is relative to the 18 | # documentation root, use os.path.abspath to make it absolute, like shown here. 19 | #sys.path.insert(0, os.path.abspath('.')) 20 | 21 | # -- General configuration ----------------------------------------------------- 22 | 23 | # If your documentation needs a minimal Sphinx version, state it here. 24 | #needs_sphinx = '1.0' 25 | 26 | # Add any Sphinx extension module names here, as strings. They can be extensions 27 | # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 28 | extensions = [] 29 | 30 | # Add any paths that contain templates here, relative to this directory. 31 | templates_path = ['_templates'] 32 | 33 | # The suffix of source filenames. 34 | source_suffix = '.rst' 35 | 36 | # The encoding of source files. 37 | #source_encoding = 'utf-8-sig' 38 | 39 | # The master toctree document. 40 | master_doc = 'index' 41 | 42 | # General information about the project. 43 | project = u'django-bcrypt' 44 | copyright = u'2011, Dumbwaiter Design and contributors' 45 | 46 | # The version info for the project you're documenting, acts as replacement for 47 | # |version| and |release|, also used in various other places throughout the 48 | # built documents. 49 | # 50 | # The short X.Y version. 51 | version = '0.9.2' 52 | # The full version, including alpha/beta/rc tags. 53 | release = '0.9.2' 54 | 55 | # The language for content autogenerated by Sphinx. Refer to documentation 56 | # for a list of supported languages. 57 | #language = None 58 | 59 | # There are two options for replacing |today|: either, you set today to some 60 | # non-false value, then it is used: 61 | #today = '' 62 | # Else, today_fmt is used as the format for a strftime call. 63 | #today_fmt = '%B %d, %Y' 64 | 65 | # List of patterns, relative to source directory, that match files and 66 | # directories to ignore when looking for source files. 67 | exclude_patterns = [] 68 | 69 | # The reST default role (used for this markup: `text`) to use for all documents. 70 | #default_role = None 71 | 72 | # If true, '()' will be appended to :func: etc. cross-reference text. 73 | #add_function_parentheses = True 74 | 75 | # If true, the current module name will be prepended to all description 76 | # unit titles (such as .. function::). 77 | #add_module_names = True 78 | 79 | # If true, sectionauthor and moduleauthor directives will be shown in the 80 | # output. They are ignored by default. 81 | #show_authors = False 82 | 83 | # The name of the Pygments (syntax highlighting) style to use. 84 | pygments_style = 'sphinx' 85 | 86 | # A list of ignored prefixes for module index sorting. 87 | #modindex_common_prefix = [] 88 | 89 | 90 | # -- Options for HTML output --------------------------------------------------- 91 | 92 | # The theme to use for HTML and HTML Help pages. See the documentation for 93 | # a list of builtin themes. 94 | html_theme = 'waiter' 95 | 96 | # Theme options are theme-specific and customize the look and feel of a theme 97 | # further. For a list of options available for each theme, see the 98 | # documentation. 99 | #html_theme_options = {} 100 | 101 | # Add any paths that contain custom themes here, relative to this directory. 102 | html_theme_path = ['../themes'] 103 | 104 | # The name for this set of Sphinx documents. If None, it defaults to 105 | # " v documentation". 106 | #html_title = None 107 | 108 | # A shorter title for the navigation bar. Default is the same as html_title. 109 | #html_short_title = None 110 | 111 | # The name of an image file (relative to this directory) to place at the top 112 | # of the sidebar. 113 | #html_logo = None 114 | 115 | # The name of an image file (within the static path) to use as favicon of the 116 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 117 | # pixels large. 118 | #html_favicon = None 119 | 120 | # Add any paths that contain custom static files (such as style sheets) here, 121 | # relative to this directory. They are copied after the builtin static files, 122 | # so a file named "default.css" will overwrite the builtin "default.css". 123 | html_static_path = ['_static'] 124 | 125 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 126 | # using the given strftime format. 127 | #html_last_updated_fmt = '%b %d, %Y' 128 | 129 | # If true, SmartyPants will be used to convert quotes and dashes to 130 | # typographically correct entities. 131 | #html_use_smartypants = True 132 | 133 | # Custom sidebar templates, maps document names to template names. 134 | #html_sidebars = {} 135 | 136 | # Additional templates that should be rendered to pages, maps page names to 137 | # template names. 138 | #html_additional_pages = {} 139 | 140 | # If false, no module index is generated. 141 | #html_domain_indices = True 142 | 143 | # If false, no index is generated. 144 | #html_use_index = True 145 | 146 | # If true, the index is split into individual pages for each letter. 147 | #html_split_index = False 148 | 149 | # If true, links to the reST sources are added to the pages. 150 | #html_show_sourcelink = True 151 | 152 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 153 | #html_show_sphinx = True 154 | 155 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 156 | #html_show_copyright = True 157 | 158 | # If true, an OpenSearch description file will be output, and all pages will 159 | # contain a tag referring to it. The value of this option must be the 160 | # base URL from which the finished HTML is served. 161 | #html_use_opensearch = '' 162 | 163 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 164 | #html_file_suffix = None 165 | 166 | # Output file base name for HTML help builder. 167 | htmlhelp_basename = 'djangobcryptdoc' 168 | 169 | 170 | # -- Options for LaTeX output -------------------------------------------------- 171 | 172 | # The paper size ('letter' or 'a4'). 173 | #latex_paper_size = 'letter' 174 | 175 | # The font size ('10pt', '11pt' or '12pt'). 176 | #latex_font_size = '10pt' 177 | 178 | # Grouping the document tree into LaTeX files. List of tuples 179 | # (source start file, target name, title, author, documentclass [howto/manual]). 180 | latex_documents = [ 181 | ('index', 'djangobcrypt.tex', u'django-bcrypt Documentation', 182 | u'Dumbwaiter Design', 'manual'), 183 | ] 184 | 185 | # The name of an image file (relative to this directory) to place at the top of 186 | # the title page. 187 | #latex_logo = None 188 | 189 | # For "manual" documents, if this is true, then toplevel headings are parts, 190 | # not chapters. 191 | #latex_use_parts = False 192 | 193 | # If true, show page references after internal links. 194 | #latex_show_pagerefs = False 195 | 196 | # If true, show URL addresses after external links. 197 | #latex_show_urls = False 198 | 199 | # Additional stuff for the LaTeX preamble. 200 | #latex_preamble = '' 201 | 202 | # Documents to append as an appendix to all manuals. 203 | #latex_appendices = [] 204 | 205 | # If false, no module index is generated. 206 | #latex_domain_indices = True 207 | 208 | 209 | # -- Options for manual page output -------------------------------------------- 210 | 211 | # One entry per manual page. List of tuples 212 | # (source start file, name, description, authors, manual section). 213 | man_pages = [ 214 | ('index', 'djangobcrypt', u'django-bcrypt Documentation', 215 | [u'Dumbwaiter Design'], 1) 216 | ] 217 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | django-bcrypt 2 | ============= 3 | 4 | `You should be using bcrypt`_. 5 | 6 | .. _You should be using bcrypt: 7 | http://codahale.com/how-to-safely-store-a-password/ 8 | 9 | django-bcrypt makes it easy to use bcrypt to hash passwords with Django. 10 | 11 | * **Mercurial:** http://bitbucket.org/dwaiter/django-bcrypt/ 12 | * **Git:** http://github.com/dwaiter/django-bcrypt/ 13 | * **Documentation:** http://django-bcrypt.rtfd.org/ 14 | * **Issues:** http://bitbucket.org/dwaiter/django-bcrypt/issues?status=new&status=open 15 | 16 | Installation and Usage 17 | ---------------------- 18 | 19 | Install the package with `pip`_ and `Mercurial`_ or `git`_:: 20 | 21 | pip install -e hg+http://bitbucket.org/dwaiter/django-bcrypt#egg=django-bcrypt 22 | 23 | # or ... 24 | 25 | pip install -e git://github.com/dwaiter/django-bcrypt.git#egg=django-bcrypt 26 | 27 | .. _pip: http://pip.openplans.org/ 28 | .. _Mercurial: http://hg-scm.org/ 29 | .. _git: http://git-scm.com/ 30 | 31 | Add ``django_bcrypt`` to your ``INSTALLED_APPS``. 32 | 33 | That's it. 34 | 35 | Any new passwords set will be hashed with bcrypt. Old passwords will still work 36 | fine. 37 | 38 | 39 | Configuration 40 | ------------- 41 | 42 | You can configure how django-bcrypt behaves with a few settings in your 43 | ``settings.py`` file. 44 | 45 | ``BCRYPT_ENABLED`` 46 | `````````````````` 47 | 48 | Enables bcrypt hashing when ``User.set_password()`` is called. 49 | 50 | Default: ``True`` 51 | 52 | ``BCRYPT_ENABLED_UNDER_TEST`` 53 | ````````````````````````````` 54 | 55 | Enables bcrypt hashing when running inside Django TestCases. 56 | 57 | Default: ``False`` (to speed up user creation) 58 | 59 | ``BCRYPT_ROUNDS`` 60 | ````````````````` 61 | 62 | Number of rounds to use for bcrypt hashing. Increase this as computers get faster. 63 | 64 | You can change the number of rounds without breaking already-hashed passwords. New 65 | passwords will use the new number of rounds, and old ones will use the old number. 66 | 67 | Default: ``12`` 68 | 69 | ``BCRYPT_MIGRATE`` 70 | `````````````````` 71 | 72 | Enables bcrypt password migration on a ``check_password()`` call. 73 | 74 | The hash is also migrated when ``BCRYPT_ROUNDS`` changes. 75 | 76 | Default: ``False`` 77 | 78 | 79 | Acknowledgements 80 | ---------------- 81 | 82 | This is pretty much a packaged-up version of `this blog post`_ for easier use. 83 | 84 | It also depends on the `py-bcrypt`_ library. 85 | 86 | .. _this blog post: 87 | http://kfalck.net/2010/12/27/blogi-linodessa-ja-bcrypt-kaytossa 88 | 89 | .. _py-bcrypt: 90 | http://www.mindrot.org/projects/py-bcrypt/ 91 | -------------------------------------------------------------------------------- /docs/themes/waiter/layout.html: -------------------------------------------------------------------------------- 1 | {% extends "basic/layout.html" %} 2 | 3 | {% block htmltitle %} 4 | {{ super() }} 5 | 6 | {% if using_theme %} 7 | 8 | {% endif %} 9 | {% endblock %} 10 | 11 | {% block sidebarlogo %} 12 | {{ super() }} 13 | {% endblock %} 14 | 15 | {% block footer %} 16 | {{ super() }} 17 | 18 | 74 | {% endblock %} 75 | -------------------------------------------------------------------------------- /docs/themes/waiter/static/rtd.css: -------------------------------------------------------------------------------- 1 | /* 2 | * rtd.css 3 | * ~~~~~~~~~~~~~~~ 4 | * 5 | * Sphinx stylesheet -- sphinxdoc theme. Originally created by 6 | * Armin Ronacher for Werkzeug. 7 | * 8 | * Customized for ReadTheDocs by Eric Pierce & Eric Holscher 9 | * 10 | * :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. 11 | * :license: BSD, see LICENSE for details. 12 | * 13 | */ 14 | 15 | /* RTD colors 16 | * light blue: #e8ecef 17 | * medium blue: #8ca1af 18 | * dark blue: #465158 19 | * dark grey: #444444 20 | * 21 | * white hover: #d1d9df; 22 | * medium blue hover: #697983; 23 | * green highlight: #8ecc4c 24 | * light blue (project bar): #e8ecef 25 | */ 26 | 27 | @import url("basic.css"); 28 | 29 | /* PAGE LAYOUT -------------------------------------------------------------- */ 30 | 31 | body { 32 | font: 100%/1.5 "ff-meta-web-pro-1","ff-meta-web-pro-2",Arial,"Helvetica Neue",sans-serif; 33 | text-align: center; 34 | color: black; 35 | background-color: #465158; 36 | padding: 0; 37 | margin: 0; 38 | } 39 | 40 | div.document { 41 | text-align: left; 42 | background-color: #e8ecef; 43 | } 44 | 45 | div.bodywrapper { 46 | background-color: #ffffff; 47 | border-left: 1px solid #ccc; 48 | border-bottom: 1px solid #ccc; 49 | margin: 0 0 0 16em; 50 | } 51 | 52 | div.body { 53 | margin: 0; 54 | padding: 0.5em 1.3em; 55 | max-width: 55em; 56 | min-width: 20em; 57 | } 58 | 59 | div.related { 60 | font-size: 1em; 61 | background-color: #465158; 62 | } 63 | 64 | div.documentwrapper { 65 | float: left; 66 | width: 100%; 67 | background-color: #e8ecef; 68 | } 69 | 70 | 71 | /* HEADINGS --------------------------------------------------------------- */ 72 | 73 | h1 { 74 | margin: 0; 75 | padding: 0.7em 0 0.3em 0; 76 | font-size: 1.5em; 77 | line-height: 1.15; 78 | color: #111; 79 | clear: both; 80 | } 81 | 82 | h2 { 83 | margin: 2em 0 0.2em 0; 84 | font-size: 1.35em; 85 | padding: 0; 86 | color: #465158; 87 | } 88 | 89 | h3 { 90 | margin: 1em 0 -0.3em 0; 91 | font-size: 1.2em; 92 | color: #6c818f; 93 | } 94 | 95 | div.body h1 a, div.body h2 a, div.body h3 a, div.body h4 a, div.body h5 a, div.body h6 a { 96 | color: black; 97 | } 98 | 99 | h1 a.anchor, h2 a.anchor, h3 a.anchor, h4 a.anchor, h5 a.anchor, h6 a.anchor { 100 | display: none; 101 | margin: 0 0 0 0.3em; 102 | padding: 0 0.2em 0 0.2em; 103 | color: #aaa !important; 104 | } 105 | 106 | h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor, 107 | h5:hover a.anchor, h6:hover a.anchor { 108 | display: inline; 109 | } 110 | 111 | h1 a.anchor:hover, h2 a.anchor:hover, h3 a.anchor:hover, h4 a.anchor:hover, 112 | h5 a.anchor:hover, h6 a.anchor:hover { 113 | color: #777; 114 | background-color: #eee; 115 | } 116 | 117 | 118 | /* LINKS ------------------------------------------------------------------ */ 119 | 120 | /* Normal links get a pseudo-underline */ 121 | a { 122 | color: #444; 123 | text-decoration: none; 124 | border-bottom: 1px solid #ccc; 125 | } 126 | 127 | /* Links in sidebar, TOC, index trees and tables have no underline */ 128 | .sphinxsidebar a, 129 | .toctree-wrapper a, 130 | .indextable a, 131 | #indices-and-tables a { 132 | color: #444; 133 | text-decoration: none; 134 | border-bottom: none; 135 | } 136 | 137 | /* Most links get an underline-effect when hovered */ 138 | a:hover, 139 | div.toctree-wrapper a:hover, 140 | .indextable a:hover, 141 | #indices-and-tables a:hover { 142 | color: #111; 143 | text-decoration: none; 144 | border-bottom: 1px solid #111; 145 | } 146 | 147 | /* Footer links */ 148 | div.footer a { 149 | color: #86989B; 150 | text-decoration: none; 151 | border: none; 152 | } 153 | div.footer a:hover { 154 | color: #a6b8bb; 155 | text-decoration: underline; 156 | border: none; 157 | } 158 | 159 | /* Permalink anchor (subtle grey with a red hover) */ 160 | div.body a.headerlink { 161 | color: #ccc; 162 | font-size: 1em; 163 | margin-left: 6px; 164 | padding: 0 4px 0 4px; 165 | text-decoration: none; 166 | border: none; 167 | } 168 | div.body a.headerlink:hover { 169 | color: #c60f0f; 170 | border: none; 171 | } 172 | 173 | 174 | /* NAVIGATION BAR --------------------------------------------------------- */ 175 | 176 | div.related ul { 177 | height: 2.5em; 178 | } 179 | 180 | div.related ul li { 181 | margin: 0; 182 | padding: 0.65em 0; 183 | float: left; 184 | display: block; 185 | color: white; /* For the >> separators */ 186 | font-size: 0.8em; 187 | } 188 | 189 | div.related ul li.right { 190 | float: right; 191 | margin-right: 5px; 192 | color: transparent; /* Hide the | separators */ 193 | } 194 | 195 | /* "Breadcrumb" links in nav bar */ 196 | div.related ul li a { 197 | order: none; 198 | background-color: inherit; 199 | font-weight: bold; 200 | margin: 6px 0 6px 4px; 201 | line-height: 1.75em; 202 | color: #ffffff; 203 | padding: 0.4em 0.8em; 204 | border: none; 205 | border-radius: 3px; 206 | } 207 | /* previous / next / modules / index links look more like buttons */ 208 | div.related ul li.right a { 209 | margin: 0.375em 0; 210 | background-color: #697983; 211 | text-shadow: 0 1px rgba(0, 0, 0, 0.5); 212 | border-radius: 3px; 213 | -webkit-border-radius: 3px; 214 | -moz-border-radius: 3px; 215 | } 216 | /* All navbar links light up as buttons when hovered */ 217 | div.related ul li a:hover { 218 | background-color: #8ca1af; 219 | color: #ffffff; 220 | text-decoration: none; 221 | border-radius: 3px; 222 | -webkit-border-radius: 3px; 223 | -moz-border-radius: 3px; 224 | } 225 | /* Take extra precautions for tt within links */ 226 | a tt, 227 | div.related ul li a tt { 228 | background: inherit !important; 229 | color: inherit !important; 230 | } 231 | 232 | 233 | /* SIDEBAR ---------------------------------------------------------------- */ 234 | 235 | div.sphinxsidebarwrapper { 236 | padding: 0; 237 | } 238 | 239 | div.sphinxsidebar { 240 | margin: 0; 241 | margin-left: -100%; 242 | float: left; 243 | top: 3em; 244 | left: 0; 245 | padding: 0 1em; 246 | width: 14em; 247 | font-size: 1em; 248 | text-align: left; 249 | background-color: #e8ecef; 250 | } 251 | 252 | div.sphinxsidebar img { 253 | max-width: 12em; 254 | } 255 | 256 | div.sphinxsidebar h3, div.sphinxsidebar h4 { 257 | margin: 1.2em 0 0.3em 0; 258 | font-size: 1em; 259 | padding: 0; 260 | color: #222222; 261 | font-family: "ff-meta-web-pro-1", "ff-meta-web-pro-2", "Arial", "Helvetica Neue", sans-serif; 262 | } 263 | 264 | div.sphinxsidebar h3 a { 265 | color: #444444; 266 | } 267 | 268 | div.sphinxsidebar ul, 269 | div.sphinxsidebar p { 270 | margin-top: 0; 271 | padding-left: 0; 272 | line-height: 130%; 273 | background-color: #e8ecef; 274 | } 275 | 276 | /* No bullets for nested lists, but a little extra indentation */ 277 | div.sphinxsidebar ul ul { 278 | list-style-type: none; 279 | margin-left: 1.5em; 280 | padding: 0; 281 | } 282 | 283 | /* A little top/bottom padding to prevent adjacent links' borders 284 | * from overlapping each other */ 285 | div.sphinxsidebar ul li { 286 | padding: 1px 0; 287 | } 288 | 289 | /* A little left-padding to make these align with the ULs */ 290 | div.sphinxsidebar p.topless { 291 | padding-left: 0 0 0 1em; 292 | } 293 | 294 | /* Make these into hidden one-liners */ 295 | div.sphinxsidebar ul li, 296 | div.sphinxsidebar p.topless { 297 | white-space: nowrap; 298 | overflow: hidden; 299 | } 300 | /* ...which become visible when hovered */ 301 | div.sphinxsidebar ul li:hover, 302 | div.sphinxsidebar p.topless:hover { 303 | overflow: visible; 304 | } 305 | 306 | /* Search text box and "Go" button */ 307 | #searchbox { 308 | margin-top: 2em; 309 | margin-bottom: 1em; 310 | background: #ddd; 311 | padding: 0.5em; 312 | border-radius: 6px; 313 | -moz-border-radius: 6px; 314 | -webkit-border-radius: 6px; 315 | } 316 | #searchbox h3 { 317 | margin-top: 0; 318 | } 319 | 320 | /* Make search box and button abut and have a border */ 321 | input, 322 | div.sphinxsidebar input { 323 | border: 1px solid #999; 324 | float: left; 325 | } 326 | 327 | /* Search textbox */ 328 | input[type="text"] { 329 | margin: 0; 330 | padding: 0 3px; 331 | height: 20px; 332 | width: 144px; 333 | border-top-left-radius: 3px; 334 | border-bottom-left-radius: 3px; 335 | -moz-border-radius-topleft: 3px; 336 | -moz-border-radius-bottomleft: 3px; 337 | -webkit-border-top-left-radius: 3px; 338 | -webkit-border-bottom-left-radius: 3px; 339 | } 340 | /* Search button */ 341 | input[type="submit"] { 342 | margin: 0 0 0 -1px; /* -1px prevents a double-border with textbox */ 343 | height: 22px; 344 | color: #444; 345 | background-color: #e8ecef; 346 | padding: 1px 4px; 347 | font-weight: bold; 348 | border-top-right-radius: 3px; 349 | border-bottom-right-radius: 3px; 350 | -moz-border-radius-topright: 3px; 351 | -moz-border-radius-bottomright: 3px; 352 | -webkit-border-top-right-radius: 3px; 353 | -webkit-border-bottom-right-radius: 3px; 354 | } 355 | input[type="submit"]:hover { 356 | color: #ffffff; 357 | background-color: #8ecc4c; 358 | } 359 | 360 | div.sphinxsidebar p.searchtip { 361 | clear: both; 362 | padding: 0.5em 0 0 0; 363 | background: #ddd; 364 | color: #666; 365 | font-size: 0.9em; 366 | } 367 | 368 | /* Sidebar links are unusual */ 369 | div.sphinxsidebar li a, 370 | div.sphinxsidebar p a { 371 | background: #e8ecef; /* In case links overlap main content */ 372 | border-radius: 3px; 373 | -moz-border-radius: 3px; 374 | -webkit-border-radius: 3px; 375 | border: 1px solid transparent; /* To prevent things jumping around on hover */ 376 | padding: 0 5px 0 5px; 377 | } 378 | div.sphinxsidebar li a:hover, 379 | div.sphinxsidebar p a:hover { 380 | color: #111; 381 | text-decoration: none; 382 | border: 1px solid #888; 383 | } 384 | 385 | /* Tweak any link appearing in a heading */ 386 | div.sphinxsidebar h3 a { 387 | } 388 | 389 | 390 | 391 | 392 | /* OTHER STUFF ------------------------------------------------------------ */ 393 | 394 | cite, code, tt { 395 | font-family: 'Consolas', 'Deja Vu Sans Mono', 396 | 'Bitstream Vera Sans Mono', monospace; 397 | font-size: 0.95em; 398 | letter-spacing: 0.01em; 399 | } 400 | 401 | tt { 402 | background-color: #f2f2f2; 403 | color: #444; 404 | } 405 | 406 | tt.descname, tt.descclassname, tt.xref { 407 | border: 0; 408 | } 409 | 410 | hr { 411 | border: 1px solid #abc; 412 | margin: 2em; 413 | } 414 | 415 | pre, #_fontwidthtest { 416 | font-family: 'Consolas', 'Deja Vu Sans Mono', 417 | 'Bitstream Vera Sans Mono', monospace; 418 | margin: 1em 2em; 419 | font-size: 0.95em; 420 | letter-spacing: 0.015em; 421 | line-height: 120%; 422 | padding: 0.5em; 423 | border: 1px solid #ccc; 424 | background-color: #eee; 425 | border-radius: 6px; 426 | -moz-border-radius: 6px; 427 | -webkit-border-radius: 6px; 428 | } 429 | 430 | pre a { 431 | color: inherit; 432 | text-decoration: underline; 433 | } 434 | 435 | td.linenos pre { 436 | padding: 0.5em 0; 437 | } 438 | 439 | div.quotebar { 440 | background-color: #f8f8f8; 441 | max-width: 250px; 442 | float: right; 443 | padding: 2px 7px; 444 | border: 1px solid #ccc; 445 | } 446 | 447 | div.topic { 448 | background-color: #f8f8f8; 449 | } 450 | 451 | table { 452 | border-collapse: collapse; 453 | margin: 0 -0.5em 0 -0.5em; 454 | } 455 | 456 | table td, table th { 457 | padding: 0.2em 0.5em 0.2em 0.5em; 458 | } 459 | 460 | 461 | /* ADMONITIONS AND WARNINGS ------------------------------------------------- */ 462 | 463 | /* Shared by admonitions and warnings */ 464 | div.admonition, div.warning { 465 | font-size: 0.9em; 466 | margin: 2em; 467 | padding: 0; 468 | /* 469 | border-radius: 6px; 470 | -moz-border-radius: 6px; 471 | -webkit-border-radius: 6px; 472 | */ 473 | } 474 | div.admonition p, div.warning p { 475 | margin: 0.5em 1em 0.5em 1em; 476 | padding: 0; 477 | } 478 | div.admonition pre, div.warning pre { 479 | margin: 0.4em 1em 0.4em 1em; 480 | } 481 | div.admonition p.admonition-title, 482 | div.warning p.admonition-title { 483 | margin: 0; 484 | padding: 0.1em 0 0.1em 0.5em; 485 | color: white; 486 | font-weight: bold; 487 | font-size: 1.1em; 488 | text-shadow: 0 1px rgba(0, 0, 0, 0.5); 489 | } 490 | div.admonition ul, div.admonition ol, 491 | div.warning ul, div.warning ol { 492 | margin: 0.1em 0.5em 0.5em 3em; 493 | padding: 0; 494 | } 495 | 496 | 497 | /* Admonitions only */ 498 | div.admonition { 499 | border: 1px solid #609060; 500 | background-color: #e9ffe9; 501 | } 502 | div.admonition p.admonition-title { 503 | background-color: #70A070; 504 | border-bottom: 1px solid #609060; 505 | } 506 | 507 | 508 | /* Warnings only */ 509 | div.warning { 510 | border: 1px solid #900000; 511 | background-color: #ffe9e9; 512 | } 513 | div.warning p.admonition-title { 514 | background-color: #b04040; 515 | border-bottom: 1px solid #900000; 516 | } 517 | 518 | 519 | 520 | div.versioninfo { 521 | margin: 1em 0 0 0; 522 | border: 1px solid #ccc; 523 | background-color: #DDEAF0; 524 | padding: 8px; 525 | line-height: 1.3em; 526 | font-size: 0.9em; 527 | } 528 | 529 | .viewcode-back { 530 | font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', 531 | 'Verdana', sans-serif; 532 | } 533 | 534 | div.viewcode-block:target { 535 | background-color: #f4debf; 536 | border-top: 1px solid #ac9; 537 | border-bottom: 1px solid #ac9; 538 | } 539 | 540 | dl { 541 | margin: 1em 0 2.5em 0; 542 | } 543 | 544 | /* Highlight target when you click an internal link */ 545 | dt:target { 546 | background: #ffe080; 547 | } 548 | /* Don't highlight whole divs */ 549 | div.highlight { 550 | background: transparent; 551 | } 552 | /* But do highlight spans (so search results can be highlighted) */ 553 | span.highlight { 554 | background: #ffe080; 555 | } 556 | 557 | div.footer { 558 | background-color: #465158; 559 | color: #eeeeee; 560 | padding: 0 2em 2em 2em; 561 | clear: both; 562 | font-size: 0.8em; 563 | text-align: center; 564 | } 565 | 566 | p { 567 | margin: 0.8em 0 0.5em 0; 568 | } 569 | 570 | .section p img { 571 | margin: 1em 2em; 572 | } 573 | 574 | 575 | /* MOBILE LAYOUT -------------------------------------------------------------- */ 576 | 577 | @media screen and (max-width: 600px) { 578 | 579 | h1, h2, h3, h4, h5 { 580 | position: relative; 581 | } 582 | 583 | ul { 584 | padding-left: 1.75em; 585 | } 586 | 587 | div.bodywrapper a.headerlink, #indices-and-tables h1 a { 588 | color: #e6e6e6; 589 | font-size: 80%; 590 | float: right; 591 | line-height: 1.8; 592 | position: absolute; 593 | right: -0.7em; 594 | visibility: inherit; 595 | } 596 | 597 | div.bodywrapper h1 a.headerlink, #indices-and-tables h1 a { 598 | line-height: 1.5; 599 | } 600 | 601 | pre { 602 | font-size: 0.7em; 603 | overflow: auto; 604 | word-wrap: break-word; 605 | white-space: pre-wrap; 606 | } 607 | 608 | div.related ul { 609 | height: 2.5em; 610 | padding: 0; 611 | text-align: left; 612 | } 613 | 614 | div.related ul li { 615 | clear: both; 616 | color: #465158; 617 | padding: 0.2em 0; 618 | } 619 | 620 | div.related ul li:last-child { 621 | border-bottom: 1px dotted #8ca1af; 622 | padding-bottom: 0.4em; 623 | margin-bottom: 1em; 624 | width: 100%; 625 | } 626 | 627 | div.related ul li a { 628 | color: #465158; 629 | padding-right: 0; 630 | } 631 | 632 | div.related ul li a:hover { 633 | background: inherit; 634 | color: inherit; 635 | } 636 | 637 | div.related ul li.right { 638 | clear: none; 639 | padding: 0.65em 0; 640 | margin-bottom: 0.5em; 641 | } 642 | 643 | div.related ul li.right a { 644 | color: #fff; 645 | padding-right: 0.8em; 646 | } 647 | 648 | div.related ul li.right a:hover { 649 | background-color: #8ca1af; 650 | } 651 | 652 | div.body { 653 | clear: both; 654 | min-width: 0; 655 | word-wrap: break-word; 656 | } 657 | 658 | div.bodywrapper { 659 | margin: 0 0 0 0; 660 | } 661 | 662 | div.sphinxsidebar { 663 | float: none; 664 | margin: 0; 665 | width: auto; 666 | } 667 | 668 | div.sphinxsidebar input[type="text"] { 669 | height: 2em; 670 | line-height: 2em; 671 | width: 70%; 672 | } 673 | 674 | div.sphinxsidebar input[type="submit"] { 675 | height: 2em; 676 | margin-left: 0.5em; 677 | width: 20%; 678 | } 679 | 680 | div.sphinxsidebar p.searchtip { 681 | background: inherit; 682 | margin-bottom: 1em; 683 | } 684 | 685 | div.sphinxsidebar ul li, div.sphinxsidebar p.topless { 686 | white-space: normal; 687 | } 688 | 689 | .bodywrapper img { 690 | display: block; 691 | margin-left: auto; 692 | margin-right: auto; 693 | max-width: 100%; 694 | } 695 | 696 | div.documentwrapper { 697 | float: none; 698 | } 699 | 700 | div.admonition, div.warning, pre, blockquote { 701 | margin-left: 0em; 702 | margin-right: 0em; 703 | } 704 | 705 | .body p img { 706 | margin: 0; 707 | } 708 | 709 | #searchbox { 710 | background: transparent; 711 | } 712 | 713 | .related:not(:first-child) li { 714 | display: none; 715 | } 716 | 717 | .related:not(:first-child) li.right { 718 | display: block; 719 | } 720 | 721 | div.footer { 722 | padding: 1em; 723 | } 724 | 725 | .rtd_doc_footer .badge { 726 | float: none; 727 | margin: 1em auto; 728 | position: static; 729 | } 730 | 731 | .rtd_doc_footer .badge.revsys-inline { 732 | margin-right: auto; 733 | margin-bottom: 2em; 734 | } 735 | 736 | table.indextable { 737 | display: block; 738 | width: auto; 739 | } 740 | 741 | .indextable tr { 742 | display: block; 743 | } 744 | 745 | .indextable td { 746 | display: block; 747 | padding: 0; 748 | width: auto !important; 749 | } 750 | 751 | .indextable td dt { 752 | margin: 1em 0; 753 | } 754 | 755 | ul.search { 756 | margin-left: 0.25em; 757 | } 758 | 759 | ul.search li div.context { 760 | font-size: 90%; 761 | line-height: 1.1; 762 | margin-bottom: 1; 763 | margin-left: 0; 764 | } 765 | 766 | } 767 | -------------------------------------------------------------------------------- /docs/themes/waiter/theme.conf: -------------------------------------------------------------------------------- 1 | [theme] 2 | inherit = basic 3 | stylesheet = rtd.css 4 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import os 2 | from setuptools import setup, find_packages 3 | 4 | install_requires = ['py-bcrypt'] 5 | 6 | README_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), 7 | 'README.rst') 8 | 9 | description = 'Make Django use bcrypt for hashing passwords.' 10 | long_description = open(README_PATH, 'r').read() 11 | 12 | setup( 13 | name='django-bcrypt', 14 | version='0.9.2', 15 | install_requires=install_requires, 16 | description=description, 17 | long_description=long_description, 18 | author='Dumbwaiter Design', 19 | author_email='dev@dwaiter.com', 20 | url='http://bitbucket.org/dwaiter/django-bcrypt/', 21 | packages=['django_bcrypt'], 22 | ) 23 | --------------------------------------------------------------------------------