File tree 1 file changed +34
-0
lines changed
readthedocs/core/migrations
1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by Django 1.11.16 on 2018-10-11 17:28
3
+ from __future__ import unicode_literals
4
+
5
+ from django .db import migrations
6
+
7
+
8
+ def forwards_func (apps , schema_editor ):
9
+ User = apps .get_model ('auth' , 'User' )
10
+
11
+ old_password_patterns = (
12
+ 'sha1$' ,
13
+ # RTD's production database doesn't have any of these
14
+ # but they are included for completeness
15
+ 'md5$' ,
16
+ 'crypt$' ,
17
+ )
18
+ for pattern in old_password_patterns :
19
+ users = User .objects .filter (password__startswith = pattern )
20
+ for user in users :
21
+ user .set_unusable_password ()
22
+ user .save ()
23
+
24
+
25
+ class Migration (migrations .Migration ):
26
+
27
+ dependencies = [
28
+ ('core' , '0004_ad-opt-out' ),
29
+ ('auth' , '0008_alter_user_username_max_length' ),
30
+ ]
31
+
32
+ operations = [
33
+ migrations .RunPython (forwards_func ),
34
+ ]
You can’t perform that action at this time.
0 commit comments