djangosnippets.org: Latest snippets tagged with 'password'https://djangosnippets.org/tags/password/2016-06-26T13:58:06.005694-05:00Crypt-SHA512 password hasher
2016-06-26T13:58:06.005694-05:00ezubillagahttps://djangosnippets.org/snippets/10572/<p>Password hashing method using the crypt-sha512 algorithm, To be able to generate password compatible with the crypt-sha512 method avaiable in the standard crypt function since glib2.7 and used on modern linux distros. This provides compatibility with programs and systems that use the glibc crypt library for encrypting passwords (such as …</p>
Freely redistributablePlaintext password
2013-10-29T11:00:07.558139-05:00yettyhttps://djangosnippets.org/snippets/2999/<p>Plaintext password hasher (encoded string: plain$1$mysecretpass). </p>
<p>DANGEROUS!!!
Use just if you know what you are doing!</p>
Freely redistributablePassword Obfuscation Log Filter
2013-06-28T17:08:04.046722-05:00nikmolnarhttps://djangosnippets.org/snippets/2966/<p>This is a simple logging <a href="https://docs.djangoproject.com/en/1.5/topics/logging/#topic-logging-parts-filters">filter</a> to ensure that user-entered passwords aren't recorded in the log or emailed to admins as part of the request data if an error occurs during registration/login.</p>
Freely redistributableInstructions and code to use drupal 7 passwords
2013-06-01T22:26:25.198340-05:00grillermohttps://djangosnippets.org/snippets/2924/<p>This is another fork of http://djangosnippets.org/snippets/2729/ that fixes the issue.</p>
<p>Unlike those other versions i give you instructions so it works for you, this is modified a little.</p>
<p>Instructions:</p>
<p>If you want to import the passwords from drupal you need to prepend to each of them the word drupal so …</p>
Freely redistributabledrupal7 password check
2012-06-22T09:51:32.041580-05:00bramhttps://djangosnippets.org/snippets/2777/<p>Completely based on <a href="http://djangosnippets.org/snippets/2729/">snippet 2729</a> (see that snippet for useful comments!).
The above snippet did not work for me (something with MemoryError), so I looked at the Drula source code and reimplemented...</p>
Freely redistributableDrupal password hasher for migration
2012-04-09T10:36:56.375528-05:00dgrtwohttps://djangosnippets.org/snippets/2729/<p>This BasePasswordHasher allows the easy migration of passwords from Drupal to Django 1.4. Drupal stores its passwords using a SHA512 hash, but with some iterations and postprocessing.</p>
<p>This snippet allows you to migrate the username and passwords over seamlessly- the only necessary change is truncating the first character of each …</p>
Freely redistributablePassword Validation - Require Letters and Numbers - no regex
2011-09-21T12:12:22.258438-05:00watchedmanhttps://djangosnippets.org/snippets/2551/<p>Simple password validation for user registration - requires that password be 7 or more characters and contain both letters and numbers. Original validation with regex approach developed by kurtis. Optimized no-regex version based on code from watchedman ran as fast or significantly faster on all systems on which we tested …</p>
Freely redistributablereset django password
2011-08-24T03:21:09.565847-05:00hugogeehttps://djangosnippets.org/snippets/2523/<p>Reset lost django password without the use of sql.</p>
Freely redistributableMySQL django password function
2009-06-01T11:36:23.437102-05:00mcostahttps://djangosnippets.org/snippets/1541/<p>This functions encodes a password in the same format as django. You can set the auth_user.password column with the result of this function:</p>
<pre><code>update `auth_user`.`password`
set `password` = django_password('secret')
where id = 1234;
</code></pre>
Freely redistributableweb-key: Base64 Shared Secret for Access Control
2009-05-27T10:17:43.185348-05:00sbwhttps://djangosnippets.org/snippets/1532/<p>At the <a href="http://iiw.idcommons.net/Iiw8">Internet Identity Workshop</a> in May, 2009, I spoke to Alan Karp and Tyler Close of HP Labs about their research on authorization without identity. Here are my <a href="http://delicious.com/sbwms/ZBAC">Delicious links</a> on the subject.</p>
<p>This led me to write code to generate a "web-key," the shared secret needed to implement …</p>
Freely redistributableOld MySQL Password Hash
2009-05-15T10:38:28.376493-05:00tbackhttps://djangosnippets.org/snippets/1508/<p>A python implementation of the old MySQL PASSWORD() function.</p>
<p>This is insecure. There is a reason MySQL changed this in version 4.1. </p>
<p>Use it only if you have to!</p>
Freely redistributableSaving passwords for other services (semi-)securely in a database
2009-02-19T12:13:38.875899-06:00equanimityhttps://djangosnippets.org/snippets/1330/<p>I've often found myself wanting to store passwords for other web services (e.g. maillist managers, IMAP accounts, IM accounts etc) for use by a web application, but have not wanted to hard-code them in <code>settings.py</code> or store them as plaintext in the database.</p>
<p>This uses the <a href="http://www.dlitz.net/software/pycrypto/">pycrypto</a> library to encrypt …</p>
Freely redistributableNo Password E-mail
2009-02-15T22:17:17.612087-06:00jefferyahttps://djangosnippets.org/snippets/1326/<p>Sometimes when a Django site's authentication backend goes down, a login will fail with a 500 error. This has happened to me when using an LDAP backend for authentication. A glitch with the settings, or ldap temporarily disappearing can make logins flake out for a short period of time.</p>
<p>That's …</p>
Freely redistributableUnusable passwords for LDAP users
2009-01-29T13:19:33.010585-06:00rob.wardhttps://djangosnippets.org/snippets/1301/<p>An example of how to modify the admin user creation form to assign an unusable password to externally authenticated users when they are created.</p>
<p>This code is more intimate with the django.contrib.auth classes than I'd like, but it should be fairly straightforward to maintain should the relevant django.contrib.auth classes change.</p>
Freely redistributableDualPasswordForm
2008-08-12T09:39:19.975510-05:00weijie90https://djangosnippets.org/snippets/964/<p>DualPasswordForm is a simple form that contains two password fields and validation to ensure that the two passwords match. A minimum password length of 7 characters is imposed, but feel free to change that.</p>
Freely redistributable