"Fossies" - the Fresh Open Source Software Archive

Member "seahub-7.1.0-pro/seahub/two_factor/migrations/0001_initial.py" (30 Dec 2019, 4353 Bytes) of package /linux/www/seahub-7.1.0-pro.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 # -*- coding: utf-8 -*-
    2 # Generated by Django 1.11.11 on 2018-03-21 08:44
    3 
    4 
    5 from django.db import migrations, models
    6 import django.db.models.deletion
    7 import seahub.base.fields
    8 import seahub.two_factor.models.base
    9 import seahub.two_factor.models.totp
   10 import seahub.two_factor.utils
   11 
   12 
   13 class Migration(migrations.Migration):
   14 
   15     initial = True
   16 
   17     dependencies = [
   18     ]
   19 
   20     operations = [
   21         migrations.CreateModel(
   22             name='PhoneDevice',
   23             fields=[
   24                 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
   25                 ('user', seahub.base.fields.LowerCaseCharField(help_text='The user that this device belongs to.', max_length=255, unique=True)),
   26                 ('name', models.CharField(help_text='The human-readable name of this device.', max_length=64)),
   27                 ('confirmed', models.BooleanField(default=True, help_text='Is this device ready for use?')),
   28                 ('number', models.CharField(max_length=40)),
   29                 ('key', models.CharField(default=seahub.two_factor.utils.random_hex, help_text='Hex-encoded secret key', max_length=40, validators=[seahub.two_factor.models.base.key_validator])),
   30                 ('method', models.CharField(choices=[('call', 'Phone Call'), ('sms', 'Text Message')], max_length=4, verbose_name='Method')),
   31             ],
   32             options={
   33                 'abstract': False,
   34             },
   35         ),
   36         migrations.CreateModel(
   37             name='StaticDevice',
   38             fields=[
   39                 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
   40                 ('user', seahub.base.fields.LowerCaseCharField(help_text='The user that this device belongs to.', max_length=255, unique=True)),
   41                 ('name', models.CharField(help_text='The human-readable name of this device.', max_length=64)),
   42                 ('confirmed', models.BooleanField(default=True, help_text='Is this device ready for use?')),
   43             ],
   44             options={
   45                 'abstract': False,
   46             },
   47         ),
   48         migrations.CreateModel(
   49             name='StaticToken',
   50             fields=[
   51                 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
   52                 ('token', models.CharField(db_index=True, max_length=16)),
   53                 ('device', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='token_set', to='two_factor.StaticDevice')),
   54             ],
   55         ),
   56         migrations.CreateModel(
   57             name='TOTPDevice',
   58             fields=[
   59                 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
   60                 ('user', seahub.base.fields.LowerCaseCharField(help_text='The user that this device belongs to.', max_length=255, unique=True)),
   61                 ('name', models.CharField(help_text='The human-readable name of this device.', max_length=64)),
   62                 ('confirmed', models.BooleanField(default=True, help_text='Is this device ready for use?')),
   63                 ('key', models.CharField(default=seahub.two_factor.models.totp.default_key, help_text='A hex-encoded secret key of up to 40 bytes.', max_length=80, validators=[seahub.two_factor.models.totp.key_validator])),
   64                 ('step', models.PositiveSmallIntegerField(default=30, help_text='The time step in seconds.')),
   65                 ('t0', models.BigIntegerField(default=0, help_text='The Unix time at which to begin counting steps.')),
   66                 ('digits', models.PositiveSmallIntegerField(choices=[(6, 6), (8, 8)], default=6, help_text='The number of digits to expect in a token.')),
   67                 ('tolerance', models.PositiveSmallIntegerField(default=1, help_text='The number of time steps in the past or future to allow.')),
   68                 ('drift', models.SmallIntegerField(default=0, help_text='The number of time steps the prover is known to deviate from our clock.')),
   69                 ('last_t', models.BigIntegerField(default=-1, help_text='The t value of the latest verified token. The next token must be at a higher time step.')),
   70             ],
   71             options={
   72                 'abstract': False,
   73                 'verbose_name': 'TOTP device',
   74             },
   75         ),
   76     ]