2019-02-28 09:58:53 +00:00
|
|
|
# Generated by Django 2.1.7 on 2019-02-28 09:15
|
|
|
|
|
|
|
|
import uuid
|
|
|
|
|
2023-05-29 11:45:55 +00:00
|
|
|
import django.utils.timezone
|
|
|
|
from django.db import migrations, models
|
|
|
|
|
2019-02-28 09:58:53 +00:00
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
|
|
('audits', '0004_operatelog_passwordchangelog_userloginlog'),
|
2019-03-04 07:38:59 +00:00
|
|
|
('users', '0019_auto_20190304_1459'),
|
2019-02-28 09:58:53 +00:00
|
|
|
]
|
2019-03-04 07:38:59 +00:00
|
|
|
state_operations = [
|
2019-02-28 09:58:53 +00:00
|
|
|
migrations.CreateModel(
|
|
|
|
name='UserLoginLog',
|
|
|
|
fields=[
|
2019-03-04 07:38:59 +00:00
|
|
|
('id', models.UUIDField(default=uuid.uuid4, primary_key=True,
|
|
|
|
serialize=False)),
|
|
|
|
('username',
|
|
|
|
models.CharField(max_length=128, verbose_name='Username')),
|
|
|
|
('type',
|
|
|
|
models.CharField(choices=[('W', 'Web'), ('T', 'Terminal')],
|
|
|
|
max_length=2, verbose_name='Login type')),
|
2023-05-29 11:45:55 +00:00
|
|
|
('ip', models.GenericIPAddressField(verbose_name='Login IP')),
|
2019-03-04 07:38:59 +00:00
|
|
|
('city', models.CharField(blank=True, max_length=254, null=True,
|
|
|
|
verbose_name='Login city')),
|
|
|
|
('user_agent',
|
|
|
|
models.CharField(blank=True, max_length=254, null=True,
|
|
|
|
verbose_name='User agent')),
|
|
|
|
('mfa', models.SmallIntegerField(
|
|
|
|
choices=[(0, 'Disabled'), (1, 'Enabled'), (2, '-')],
|
|
|
|
default=2, verbose_name='MFA')),
|
|
|
|
('reason', models.SmallIntegerField(
|
|
|
|
choices=[(0, '-'), (1, 'Username/password check failed'),
|
|
|
|
(2, 'MFA authentication failed'),
|
|
|
|
(3, 'Username does not exist'),
|
|
|
|
(4, 'Password expired')], default=0,
|
|
|
|
verbose_name='Reason')),
|
|
|
|
('status', models.BooleanField(
|
|
|
|
choices=[(True, 'Success'), (False, 'Failed')],
|
|
|
|
default=True, max_length=2, verbose_name='Status')),
|
|
|
|
('datetime',
|
|
|
|
models.DateTimeField(default=django.utils.timezone.now,
|
2024-02-22 09:46:12 +00:00
|
|
|
verbose_name='Login Date')),
|
2019-02-28 09:58:53 +00:00
|
|
|
],
|
|
|
|
options={
|
|
|
|
'ordering': ['-datetime', 'username'],
|
|
|
|
},
|
|
|
|
),
|
|
|
|
]
|
2019-03-04 07:38:59 +00:00
|
|
|
|
|
|
|
operations = [
|
|
|
|
migrations.SeparateDatabaseAndState(state_operations=state_operations)
|
|
|
|
]
|