# Generated by Django 3.2.4 on 2021-07-30 05:12

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("xauth", "0001_initial"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("accounts", "0001_initial"),
    ]

    operations = [
        migrations.CreateModel(
            name="SecurityQuestion",
            fields=[
                ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
                ("question", models.CharField(max_length=255, unique=True)),
                ("added_on", models.DateTimeField(auto_now_add=True)),
            ],
            options={
                "abstract": False,
            },
        ),
        migrations.AddField(
            model_name="passwordresetlog",
            name="user",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE, related_name="password_reset", to=settings.AUTH_USER_MODEL
            ),
        ),
        migrations.AddField(
            model_name="failedsigninattempt",
            name="user",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE, related_name="signin_attempts", to=settings.AUTH_USER_MODEL
            ),
        ),
        migrations.CreateModel(
            name="Security",
            fields=[
                (
                    "user",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        primary_key=True,
                        related_name="security",
                        serialize=False,
                        to="xauth.user",
                    ),
                ),
                ("security_question_answer", models.CharField(max_length=150, null=True)),
                ("temporary_password", models.CharField(max_length=128, null=True)),
                ("verification_code", models.CharField(max_length=128, null=True)),
                ("temporary_password_generation_time", models.DateTimeField(blank=True, null=True)),
                ("verification_code_generation_time", models.DateTimeField(blank=True, null=True)),
                ("account_deactivation_time", models.DateTimeField(blank=True, null=True)),
                (
                    "security_question",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        to="accounts.securityquestion",
                    ),
                ),
            ],
            options={
                "abstract": False,
                "unique_together": {("user", "security_question")},
            },
        ),
    ]
