Initial commit
This commit is contained in:
35
accounts/migrations/0003_loginthrottle.py
Normal file
35
accounts/migrations/0003_loginthrottle.py
Normal file
@@ -0,0 +1,35 @@
|
||||
# Generated by Django 5.2.8 on 2025-11-17 12:27
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('accounts', '0002_loginrecord'),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='LoginThrottle',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('ip_address', models.GenericIPAddressField(blank=True, null=True)),
|
||||
('fail_count', models.PositiveIntegerField(default=0)),
|
||||
('total_fail_count', models.PositiveIntegerField(default=0)),
|
||||
('last_failed_at', models.DateTimeField(blank=True, null=True)),
|
||||
('banned_until', models.DateTimeField(blank=True, null=True)),
|
||||
('note', models.CharField(blank=True, default='', max_length=255)),
|
||||
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='login_throttles', to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': '登录节流',
|
||||
'verbose_name_plural': '登录节流',
|
||||
'ordering': ['-last_failed_at'],
|
||||
'indexes': [models.Index(fields=['ip_address'], name='accounts_lo_ip_addr_8398ca_idx'), models.Index(fields=['user'], name='accounts_lo_user_id_6fc439_idx'), models.Index(fields=['banned_until'], name='accounts_lo_banned__b750cc_idx')],
|
||||
},
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user