-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): add User.email_verified, set during auth action authentica…
…tion
- Loading branch information
1 parent
e1f4030
commit b801018
Showing
4 changed files
with
45 additions
and
2 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
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,30 @@ | ||
# Generated by Django 4.0.1 on 2022-01-14 13:39 | ||
|
||
import datetime | ||
|
||
from django.db import migrations, models | ||
from django.db.models import F, Q | ||
|
||
|
||
def forwards_func(apps, schema_editor): | ||
User = apps.get_model("desecapi", "User") | ||
db_alias = schema_editor.connection.alias | ||
filter = Q(is_active=True) | ~Q(last_login__isnull=True) | ||
filter_kwargs = dict(created__date__gte=datetime.date(2019, 10, 23)) | ||
User.objects.using(db_alias).filter(filter, **filter_kwargs).update(email_verified=F('created')) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('desecapi', '0019_alter_user_is_active'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='user', | ||
name='email_verified', | ||
field=models.DateTimeField(blank=True, null=True), | ||
), | ||
migrations.RunPython(forwards_func, migrations.RunPython.noop), | ||
] |
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