diff --git a/passbook/lib/templatetags/passbook_utils.py b/passbook/lib/templatetags/passbook_utils.py index 2d5af96cb..aa8cc062f 100644 --- a/passbook/lib/templatetags/passbook_utils.py +++ b/passbook/lib/templatetags/passbook_utils.py @@ -5,7 +5,7 @@ from urllib.parse import urlencode from django import template from django.db.models import Model from django.template import Context -from django.utils.html import escape +from django.utils.html import escape, mark_safe from structlog import get_logger from passbook.lib.config import CONFIG @@ -105,4 +105,4 @@ def debug(obj) -> str: @register.filter def doc(obj) -> str: """Return docstring of object""" - return obj.__doc__ + return mark_safe(obj.__doc__.replace("\n", "
")) diff --git a/passbook/policies/expression/models.py b/passbook/policies/expression/models.py index 103be2b69..67137d0b6 100644 --- a/passbook/policies/expression/models.py +++ b/passbook/policies/expression/models.py @@ -8,7 +8,7 @@ from passbook.policies.types import PolicyRequest, PolicyResult class ExpressionPolicy(Policy): - """Implement custom logic using python.""" + """Execute arbitrary Python code to implement custom checksĀ and validation.""" expression = models.TextField() diff --git a/passbook/policies/hibp/models.py b/passbook/policies/hibp/models.py index 18b395e66..613594474 100644 --- a/passbook/policies/hibp/models.py +++ b/passbook/policies/hibp/models.py @@ -13,7 +13,7 @@ LOGGER = get_logger() class HaveIBeenPwendPolicy(Policy): - """Check if password is on HaveIBeenPwned's list by upload the first + """Check if password is on HaveIBeenPwned's list by uploading the first 5 characters of the SHA1 Hash.""" allowed_count = models.IntegerField(default=0) diff --git a/passbook/providers/oauth/models.py b/passbook/providers/oauth/models.py index 157f8a21a..7a42d1d0e 100644 --- a/passbook/providers/oauth/models.py +++ b/passbook/providers/oauth/models.py @@ -12,8 +12,9 @@ from passbook.lib.utils.template import render_to_string class OAuth2Provider(Provider, AbstractApplication): - """Generic OAuth2 Provider for applications not using OpenID-Connect. This Provider - also supports the GitHub-pretend mode.""" + """Generic OAuth2 Provider for applications not using OpenID-Connect. + This Provider also supports the GitHub-pretend mode for Applications that don't support + generic OAuth.""" form = "passbook.providers.oauth.forms.OAuth2ProviderForm" diff --git a/passbook/providers/saml/models.py b/passbook/providers/saml/models.py index bcb1f7f57..f5a63b6ed 100644 --- a/passbook/providers/saml/models.py +++ b/passbook/providers/saml/models.py @@ -25,7 +25,7 @@ class SAMLBindings(models.TextChoices): class SAMLProvider(Provider): - """SAML 2.0-based authentication protocol.""" + """SAML 2.0 Endpoint for applications which support SAML.""" name = models.TextField() processor_path = models.CharField(max_length=255, choices=[]) @@ -157,7 +157,7 @@ class SAMLProvider(Provider): class SAMLPropertyMapping(PropertyMapping): - """SAML Property mapping, allowing Name/FriendlyName mapping to a list of strings""" + """Map User/Group attribute to SAML Attribute, which can be used by the Service Provider.""" saml_name = models.TextField(verbose_name="SAML Name") friendly_name = models.TextField(default=None, blank=True, null=True) diff --git a/passbook/sources/ldap/models.py b/passbook/sources/ldap/models.py index 4759463fb..0de975870 100644 --- a/passbook/sources/ldap/models.py +++ b/passbook/sources/ldap/models.py @@ -10,7 +10,7 @@ from passbook.core.models import Group, PropertyMapping, Source class LDAPSource(Source): - """LDAP Authentication source""" + """Federate LDAP Directory with passbook, or create new accounts in LDAP.""" server_uri = models.TextField( validators=[URLValidator(schemes=["ldap", "ldaps"])], @@ -81,7 +81,7 @@ class LDAPSource(Source): class LDAPPropertyMapping(PropertyMapping): - """Map LDAP Property to User or Group object""" + """Map LDAP Property to User or Group object attribute""" object_field = models.TextField() diff --git a/passbook/sources/oauth/models.py b/passbook/sources/oauth/models.py index dcc60e742..1012f37dc 100644 --- a/passbook/sources/oauth/models.py +++ b/passbook/sources/oauth/models.py @@ -11,7 +11,7 @@ from passbook.sources.oauth.clients import get_client class OAuthSource(Source): - """Configuration for OAuth provider.""" + """Login using a Generic OAuth provider.""" provider_type = models.CharField(max_length=255) request_token_url = models.CharField( @@ -78,7 +78,7 @@ class OAuthSource(Source): class GitHubOAuthSource(OAuthSource): - """Abstract subclass of OAuthSource to specify GitHub Form""" + """Social Login using GitHub.com or a GitHub-Enterprise Instance.""" form = "passbook.sources.oauth.forms.GitHubOAuthSourceForm" @@ -90,7 +90,7 @@ class GitHubOAuthSource(OAuthSource): class TwitterOAuthSource(OAuthSource): - """Abstract subclass of OAuthSource to specify Twitter Form""" + """Social Login using Twitter.com""" form = "passbook.sources.oauth.forms.TwitterOAuthSourceForm" @@ -102,7 +102,7 @@ class TwitterOAuthSource(OAuthSource): class FacebookOAuthSource(OAuthSource): - """Abstract subclass of OAuthSource to specify Facebook Form""" + """Social Login using Facebook.com.""" form = "passbook.sources.oauth.forms.FacebookOAuthSourceForm" @@ -114,7 +114,7 @@ class FacebookOAuthSource(OAuthSource): class DiscordOAuthSource(OAuthSource): - """Abstract subclass of OAuthSource to specify Discord Form""" + """Social Login using Discord.""" form = "passbook.sources.oauth.forms.DiscordOAuthSourceForm" @@ -126,7 +126,7 @@ class DiscordOAuthSource(OAuthSource): class GoogleOAuthSource(OAuthSource): - """Abstract subclass of OAuthSource to specify Google Form""" + """Social Login using Google or Gsuite.""" form = "passbook.sources.oauth.forms.GoogleOAuthSourceForm" @@ -138,7 +138,7 @@ class GoogleOAuthSource(OAuthSource): class AzureADOAuthSource(OAuthSource): - """Abstract subclass of OAuthSource to specify AzureAD Form""" + """Social Login using Azure AD.""" form = "passbook.sources.oauth.forms.AzureADOAuthSourceForm" @@ -150,7 +150,7 @@ class AzureADOAuthSource(OAuthSource): class OpenIDOAuthSource(OAuthSource): - """Abstract subclass of OAuthSource to specify OpenID Form""" + """Login using a Generic OpenID-Connect compliant provider.""" form = "passbook.sources.oauth.forms.OAuthSourceForm" diff --git a/passbook/sources/saml/models.py b/passbook/sources/saml/models.py index f22b98907..d48716258 100644 --- a/passbook/sources/saml/models.py +++ b/passbook/sources/saml/models.py @@ -17,7 +17,7 @@ class SAMLBindingTypes(models.TextChoices): class SAMLSource(Source): - """SAML Source""" + """Authenticate using an external SAML Identity Provider.""" issuer = models.TextField( blank=True, diff --git a/passbook/stages/captcha/models.py b/passbook/stages/captcha/models.py index 492ac2f35..db52e4722 100644 --- a/passbook/stages/captcha/models.py +++ b/passbook/stages/captcha/models.py @@ -6,7 +6,7 @@ from passbook.flows.models import Stage class CaptchaStage(Stage): - """Captcha Stage instance""" + """Verify the user is human using Google's reCaptcha.""" public_key = models.TextField( help_text=_( diff --git a/passbook/stages/consent/models.py b/passbook/stages/consent/models.py index 0843827af..3132474c5 100644 --- a/passbook/stages/consent/models.py +++ b/passbook/stages/consent/models.py @@ -5,7 +5,7 @@ from passbook.flows.models import Stage class ConsentStage(Stage): - """Consent Stage instance""" + """Prompt the user for confirmation.""" type = "passbook.stages.consent.stage.ConsentStage" form = "passbook.stages.consent.forms.ConsentStageForm" diff --git a/passbook/stages/dummy/models.py b/passbook/stages/dummy/models.py index 70457e217..b934a9d10 100644 --- a/passbook/stages/dummy/models.py +++ b/passbook/stages/dummy/models.py @@ -5,7 +5,7 @@ from passbook.flows.models import Stage class DummyStage(Stage): - """Dummy stage, mostly used to debug""" + """Used for debugging.""" type = "passbook.stages.dummy.stage.DummyStage" form = "passbook.stages.dummy.forms.DummyStageForm" diff --git a/passbook/stages/email/models.py b/passbook/stages/email/models.py index ddfe0f45a..6508704b3 100644 --- a/passbook/stages/email/models.py +++ b/passbook/stages/email/models.py @@ -21,7 +21,7 @@ class EmailTemplates(models.TextChoices): class EmailStage(Stage): - """Email-based verification.""" + """Sends an Email to the user with a token to confirm their Email address.""" host = models.TextField(default="localhost") port = models.IntegerField(default=25) diff --git a/passbook/stages/identification/models.py b/passbook/stages/identification/models.py index f225b40e4..bc5c4cecc 100644 --- a/passbook/stages/identification/models.py +++ b/passbook/stages/identification/models.py @@ -21,7 +21,7 @@ class Templates(models.TextChoices): class IdentificationStage(Stage): - """Identification stage, allows a user to identify themselves to authenticate.""" + """Allows the user to identify themselves for authentication.""" user_fields = ArrayField( models.CharField(max_length=100, choices=UserFields.choices), diff --git a/passbook/stages/invitation/models.py b/passbook/stages/invitation/models.py index 8974440c5..5b9024aec 100644 --- a/passbook/stages/invitation/models.py +++ b/passbook/stages/invitation/models.py @@ -10,7 +10,8 @@ from passbook.flows.models import Stage class InvitationStage(Stage): - """Invitation stage, to enroll themselves with enforced parameters""" + """Simplify enrollment; allow users to use a single + link to create their user with pre-defined parameters.""" continue_flow_without_invitation = models.BooleanField( default=False, diff --git a/passbook/stages/otp_static/models.py b/passbook/stages/otp_static/models.py index 63da93211..0d6b9a7a0 100644 --- a/passbook/stages/otp_static/models.py +++ b/passbook/stages/otp_static/models.py @@ -10,7 +10,7 @@ from passbook.flows.models import Stage class OTPStaticStage(Stage): - """Generate static tokens for the user as a backup""" + """Generate static tokens for the user as a backup.""" token_count = models.IntegerField(default=6) diff --git a/passbook/stages/otp_time/models.py b/passbook/stages/otp_time/models.py index 5d4c14b16..73b6840e5 100644 --- a/passbook/stages/otp_time/models.py +++ b/passbook/stages/otp_time/models.py @@ -17,7 +17,7 @@ class TOTPDigits(models.IntegerChoices): class OTPTimeStage(Stage): - """Enroll a user's device into Time-based OTP""" + """Enroll a user's device into Time-based OTP.""" digits = models.IntegerField(choices=TOTPDigits.choices) diff --git a/passbook/stages/otp_validate/models.py b/passbook/stages/otp_validate/models.py index 7e8ab7d38..4015aa365 100644 --- a/passbook/stages/otp_validate/models.py +++ b/passbook/stages/otp_validate/models.py @@ -6,7 +6,7 @@ from passbook.flows.models import NotConfiguredAction, Stage class OTPValidateStage(Stage): - """Validate user's configured OTP Device""" + """Validate user's configured OTP Device.""" not_configured_action = models.TextField( choices=NotConfiguredAction.choices, default=NotConfiguredAction.SKIP diff --git a/passbook/stages/password/models.py b/passbook/stages/password/models.py index 0a327f341..24275916f 100644 --- a/passbook/stages/password/models.py +++ b/passbook/stages/password/models.py @@ -13,7 +13,7 @@ from passbook.flows.views import NEXT_ARG_NAME class PasswordStage(Stage): - """Password-based Django-backend Authentication Stage""" + """Prompts the user for their password, and validates it against the configured backends.""" backends = ArrayField( models.TextField(), diff --git a/passbook/stages/prompt/models.py b/passbook/stages/prompt/models.py index fbdf8835e..1cea88068 100644 --- a/passbook/stages/prompt/models.py +++ b/passbook/stages/prompt/models.py @@ -95,7 +95,7 @@ class Prompt(models.Model): class PromptStage(PolicyBindingModel, Stage): - """Prompt Stage, pointing to multiple prompts""" + """Define arbitrary prompts for the user.""" fields = models.ManyToManyField(Prompt) diff --git a/passbook/stages/user_delete/models.py b/passbook/stages/user_delete/models.py index f7ad5a520..1e9483ad3 100644 --- a/passbook/stages/user_delete/models.py +++ b/passbook/stages/user_delete/models.py @@ -5,7 +5,8 @@ from passbook.flows.models import Stage class UserDeleteStage(Stage): - """Delete stage, delete a user from saved data.""" + """Deletes the currently pending user without confirmation. + Use with caution.""" type = "passbook.stages.user_delete.stage.UserDeleteStageView" form = "passbook.stages.user_delete.forms.UserDeleteStageForm" diff --git a/passbook/stages/user_login/models.py b/passbook/stages/user_login/models.py index 18a5bf4aa..13c5164d5 100644 --- a/passbook/stages/user_login/models.py +++ b/passbook/stages/user_login/models.py @@ -5,7 +5,7 @@ from passbook.flows.models import Stage class UserLoginStage(Stage): - """Login stage, allows a user to identify themselves to authenticate.""" + """Attaches the currently pending user to the current session.""" type = "passbook.stages.user_login.stage.UserLoginStageView" form = "passbook.stages.user_login.forms.UserLoginStageForm" diff --git a/passbook/stages/user_logout/models.py b/passbook/stages/user_logout/models.py index 55a03983b..51833bfe1 100644 --- a/passbook/stages/user_logout/models.py +++ b/passbook/stages/user_logout/models.py @@ -5,7 +5,7 @@ from passbook.flows.models import Stage class UserLogoutStage(Stage): - """Logout stage, allows a user to identify themselves to authenticate.""" + """Resets the users current session.""" type = "passbook.stages.user_logout.stage.UserLogoutStageView" form = "passbook.stages.user_logout.forms.UserLogoutStageForm" diff --git a/passbook/stages/user_write/models.py b/passbook/stages/user_write/models.py index 078b4e174..140b5623d 100644 --- a/passbook/stages/user_write/models.py +++ b/passbook/stages/user_write/models.py @@ -5,7 +5,8 @@ from passbook.flows.models import Stage class UserWriteStage(Stage): - """Write stage, write a user from saved data.""" + """Writes currently pending data into the pending user, or if no user exists, + creates a new user with the data.""" type = "passbook.stages.user_write.stage.UserWriteStageView" form = "passbook.stages.user_write.forms.UserWriteStageForm"