diff --git a/passbook/core/migrations/0009_auto_20200221_1410.py b/passbook/core/migrations/0009_auto_20200221_1410.py new file mode 100644 index 000000000..3a1a355d0 --- /dev/null +++ b/passbook/core/migrations/0009_auto_20200221_1410.py @@ -0,0 +1,52 @@ +# Generated by Django 3.0.3 on 2020-02-21 14:10 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("passbook_core", "0008_auto_20200220_1242"), + ] + + operations = [ + migrations.AlterField( + model_name="application", + name="name", + field=models.TextField(help_text="Application's display Name."), + ), + migrations.AlterField( + model_name="application", + name="slug", + field=models.SlugField( + help_text="Internal application name, used in URLs." + ), + ), + migrations.AlterField( + model_name="factor", + name="name", + field=models.TextField(help_text="Factor's display Name."), + ), + migrations.AlterField( + model_name="factor", + name="slug", + field=models.SlugField( + help_text="Internal factor name, used in URLs.", unique=True + ), + ), + migrations.AlterField( + model_name="source", + name="name", + field=models.TextField(help_text="Source's display Name."), + ), + migrations.AlterField( + model_name="source", + name="slug", + field=models.SlugField(help_text="Internal source name, used in URLs."), + ), + migrations.AlterField( + model_name="user", + name="name", + field=models.TextField(help_text="User's display name."), + ), + ] diff --git a/passbook/core/models.py b/passbook/core/models.py index d11e2c906..e8157f64f 100644 --- a/passbook/core/models.py +++ b/passbook/core/models.py @@ -62,7 +62,7 @@ class User(ExportModelOperationsMixin("user"), GuardianUserMixin, AbstractUser): """Custom User model to allow easier adding o f user-based settings""" uuid = models.UUIDField(default=uuid4, editable=False) - name = models.TextField() + name = models.TextField(help_text=_("User's display name.")) sources = models.ManyToManyField("Source", through="UserSourceConnection") groups = models.ManyToManyField("Group") @@ -106,8 +106,10 @@ class PolicyModel(UUIDModel, CreatedUpdatedModel): class Factor(ExportModelOperationsMixin("factor"), PolicyModel): """Authentication factor, multiple instances of the same Factor can be used""" - name = models.TextField() - slug = models.SlugField(unique=True) + name = models.TextField(help_text=_("Factor's display Name.")) + slug = models.SlugField( + unique=True, help_text=_("Internal factor name, used in URLs.") + ) order = models.IntegerField() enabled = models.BooleanField(default=True) @@ -130,8 +132,8 @@ class Application(ExportModelOperationsMixin("application"), PolicyModel): needs an Application record. Other authentication types can subclass this Model to add custom fields and other properties""" - name = models.TextField() - slug = models.SlugField() + name = models.TextField(help_text=_("Application's display Name.")) + slug = models.SlugField(help_text=_("Internal application name, used in URLs.")) skip_authorization = models.BooleanField(default=False) provider = models.OneToOneField( "Provider", null=True, blank=True, default=None, on_delete=models.SET_DEFAULT @@ -157,8 +159,8 @@ class Application(ExportModelOperationsMixin("application"), PolicyModel): class Source(ExportModelOperationsMixin("source"), PolicyModel): """Base Authentication source, i.e. an OAuth Provider, SAML Remote or LDAP Server""" - name = models.TextField() - slug = models.SlugField() + name = models.TextField(help_text=_("Source's display Name.")) + slug = models.SlugField(help_text=_("Internal source name, used in URLs.")) enabled = models.BooleanField(default=True) property_mappings = models.ManyToManyField( diff --git a/passbook/factors/captcha/migrations/0002_auto_20200221_1410.py b/passbook/factors/captcha/migrations/0002_auto_20200221_1410.py new file mode 100644 index 000000000..0960ee54d --- /dev/null +++ b/passbook/factors/captcha/migrations/0002_auto_20200221_1410.py @@ -0,0 +1,27 @@ +# Generated by Django 3.0.3 on 2020-02-21 14:10 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("passbook_factors_captcha", "0001_initial"), + ] + + operations = [ + migrations.AlterField( + model_name="captchafactor", + name="private_key", + field=models.TextField( + help_text="Private key, acquired from https://www.google.com/recaptcha/intro/v3.html" + ), + ), + migrations.AlterField( + model_name="captchafactor", + name="public_key", + field=models.TextField( + help_text="Public key, acquired from https://www.google.com/recaptcha/intro/v3.html" + ), + ), + ] diff --git a/passbook/factors/captcha/models.py b/passbook/factors/captcha/models.py index 84d96c59c..3619bb6e5 100644 --- a/passbook/factors/captcha/models.py +++ b/passbook/factors/captcha/models.py @@ -1,6 +1,6 @@ """passbook captcha factor""" from django.db import models -from django.utils.translation import gettext as _ +from django.utils.translation import gettext_lazy as _ from passbook.core.models import Factor @@ -8,8 +8,16 @@ from passbook.core.models import Factor class CaptchaFactor(Factor): """Captcha Factor instance""" - public_key = models.TextField() - private_key = models.TextField() + public_key = models.TextField( + help_text=_( + "Public key, acquired from https://www.google.com/recaptcha/intro/v3.html" + ) + ) + private_key = models.TextField( + help_text=_( + "Private key, acquired from https://www.google.com/recaptcha/intro/v3.html" + ) + ) type = "passbook.factors.captcha.factor.CaptchaFactor" form = "passbook.factors.captcha.forms.CaptchaFactorForm" diff --git a/passbook/factors/password/migrations/0004_auto_20200221_1410.py b/passbook/factors/password/migrations/0004_auto_20200221_1410.py new file mode 100644 index 000000000..a34fdb1b9 --- /dev/null +++ b/passbook/factors/password/migrations/0004_auto_20200221_1410.py @@ -0,0 +1,23 @@ +# Generated by Django 3.0.3 on 2020-02-21 14:10 + +import django.contrib.postgres.fields +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("passbook_factors_password", "0003_passwordfactor_reset_factors"), + ] + + operations = [ + migrations.AlterField( + model_name="passwordfactor", + name="backends", + field=django.contrib.postgres.fields.ArrayField( + base_field=models.TextField(), + help_text="Selection of backends to test the password against.", + size=None, + ), + ), + ] diff --git a/passbook/factors/password/models.py b/passbook/factors/password/models.py index a97980641..9247f80be 100644 --- a/passbook/factors/password/models.py +++ b/passbook/factors/password/models.py @@ -10,7 +10,10 @@ from passbook.core.types import UIUserSettings class PasswordFactor(Factor): """Password-based Django-backend Authentication Factor""" - backends = ArrayField(models.TextField()) + backends = ArrayField( + models.TextField(), + help_text=_("Selection of backends to test the password against."), + ) password_policies = models.ManyToManyField(Policy, blank=True) reset_factors = models.ManyToManyField( Factor, blank=True, related_name="reset_factors" diff --git a/passbook/factors/view.py b/passbook/factors/view.py index a81357e42..a26877edc 100644 --- a/passbook/factors/view.py +++ b/passbook/factors/view.py @@ -4,7 +4,7 @@ from typing import List, Optional, Tuple from django.contrib.auth import login from django.contrib.auth.mixins import UserPassesTestMixin from django.http import HttpRequest, HttpResponse -from django.shortcuts import get_object_or_404, redirect, render, reverse +from django.shortcuts import get_object_or_404, redirect, reverse from django.utils.http import urlencode from django.views.generic import View from structlog import get_logger