-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue #2: information leakage in admin panel
- Loading branch information
1 parent
c5ef98f
commit 7e11ed6
Showing
4 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
django_rest_multitokenauth/migrations/0003_pk_migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
def populate_auto_incrementing_pk_field(apps, schema_editor): | ||
MultiToken = apps.get_model('django_rest_multitokenauth', 'MultiToken') | ||
|
||
# Generate values for the new id column | ||
for i, o in enumerate(MultiToken.objects.all()): | ||
o.id = i + 1 | ||
o.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('django_rest_multitokenauth', '0002_rename_ip_address_20160426',), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='multitoken', | ||
name='id', | ||
field=models.IntegerField(null=True), | ||
preserve_default=True, | ||
), | ||
migrations.RunPython( | ||
populate_auto_incrementing_pk_field, | ||
migrations.RunPython.noop | ||
), | ||
# add primary key information to id field | ||
migrations.AlterField( | ||
model_name='multitoken', | ||
name='id', | ||
field=models.AutoField(primary_key=True, serialize=False) | ||
), | ||
# remove primary key information from 'key' field | ||
migrations.AlterField( | ||
model_name='multitoken', | ||
name='key', | ||
field=models.CharField(db_index=True, max_length=64, unique=True, verbose_name='Key'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters