Skip to content

Commit

Permalink
Merge branch 'feat-add-fields-to-handle-authentication' into feat-han…
Browse files Browse the repository at this point in the history
…dle-user-authentication
  • Loading branch information
ERosendo committed Jun 1, 2023
2 parents 980ae14 + ca7b340 commit 81e6b6e
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bc/users/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class UserChannelInline(admin.TabularInline):
class UserAdmin(BaseUserAdmin):
fieldsets = BaseUserAdmin.fieldsets + ( # type: ignore
# Custom fields added on to the bottom
("Extra Fields", {"fields": ["affiliation"]}),
("Extra Fields", {"fields": ["affiliation", "email_confirmed"]}),
)
add_fieldsets = (
(None, {"classes": ["wide"], "fields": ["email"]}),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Generated by Django 4.1.7 on 2023-05-31 16:36

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("users", "0002_alter_user_affiliation_noop"),
]

operations = [
migrations.AddField(
model_name="user",
name="activation_key",
field=models.CharField(default="", max_length=40),
),
migrations.AddField(
model_name="user",
name="email_confirmed",
field=models.BooleanField(
default=False,
help_text="The user has confirmed their email address",
),
),
migrations.AddField(
model_name="user",
name="key_expires",
field=models.DateTimeField(
blank=True,
help_text="The time and date when the user's activation_key expires",
null=True,
),
),
]
10 changes: 10 additions & 0 deletions bc/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ class User(AbstractDateTimeModel, AbstractUser):
help_text="The email address of the user.",
unique=True,
)
activation_key = models.CharField(max_length=40, default="")
key_expires = models.DateTimeField(
help_text="The time and date when the user's activation_key expires",
blank=True,
null=True,
)
email_confirmed = models.BooleanField(
help_text="The user has confirmed their email address",
default=False,
)
affiliation = models.TextField(help_text="User's affiliations", blank=True)

@property
Expand Down

0 comments on commit 81e6b6e

Please sign in to comment.