- Timestamp:
- Jun 15, 2014, 9:42:51 PM (11 years ago)
- Branches:
- master
- Children:
- ff623c3
- Parents:
- 5c334f6
- git-author:
- Alex Dehnert <adehnert@…> (06/15/14 17:51:08)
- git-committer:
- Alex Dehnert <adehnert@…> (06/15/14 21:42:51)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
remit/finance_core/migrations/0004_socket_auth_password.py
r38843de r75ccc48 3 3 from south.db import db 4 4 from south.v2 import DataMigration 5 from django.contrib.auth.hashers import UNUSABLE_PASSWORD 5 import django.contrib.auth.hashers 6 6 from django.db import models 7 from django.db.models import F 7 8 8 9 class Migration(DataMigration): … … 11 12 "Write your forwards methods here." 12 13 issues = orm['auth.user'].objects.filter(password__in=['', 'SocketAuth']) 13 issues.update(password=UNUSABLE_PASSWORD) 14 try: # pre-1.6 15 new_password = django.contrib.auth.hashers.UNUSABLE_PASSWORD 16 except AttributeError: # post-1.6 17 # See https://code.djangoproject.com/ticket/20079 for details on the change. 18 # Ideally, we'd use a different suffix per user, but I don't want 19 # to deal with that, and this is probably acceptably secure. 20 # 21 # Also, it seems a little unlikely that this code will actually 22 # run -- it requires an install that hasn't already run the 23 # migration (notably, esp.mit.edu has already), but *does* have 24 # accounts with SocketAuth passwords. 25 prefix = django.contrib.auth.hashers.UNUSABLE_PASSWORD_PREFIX 26 suffix = django.contrib.auth.hashers.get_random_string(django.contrib.auth.hashers.UNUSABLE_PASSWORD_SUFFIX_LENGTH) 27 new_password = prefix + F("password") + prefix + suffix 28 issues.update(password=new_password) 14 29 15 30 def backwards(self, orm):
Note: See TracChangeset
for help on using the changeset viewer.