From 5e8a1e3c0df8cefb66f0b7a94c83fa92798fe521 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 18 Jun 2020 19:35:54 +0200 Subject: [PATCH] *: make email naming consistent --- mkdocs.yml | 2 +- passbook/providers/oauth/settings.py | 6 ++-- passbook/stages/email/forms.py | 4 +-- passbook/stages/email/models.py | 2 +- passbook/stages/email/stage.py | 4 +-- passbook/stages/email/tasks.py | 2 +- .../email/for_email/password_reset.html | 2 +- .../stages/email/waiting_message.html | 4 +-- passbook/stages/identification/tests.py | 4 +-- passbook/stages/otp/views.py | 2 +- .../migrations/0004_auto_20200618_1735.py | 33 +++++++++++++++++++ passbook/stages/prompt/models.py | 2 +- swagger.yaml | 2 +- 13 files changed, 50 insertions(+), 19 deletions(-) create mode 100644 passbook/stages/prompt/migrations/0004_auto_20200618_1735.py diff --git a/mkdocs.yml b/mkdocs.yml index 29c074b3d..5753f3a6f 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -15,7 +15,7 @@ nav: - Stages: - Captcha Stage: flow/stages/captcha/index.md - Dummy Stage: flow/stages/dummy/index.md - - E-Mail Stage: flow/stages/email/index.md + - Email Stage: flow/stages/email/index.md - Identification Stage: flow/stages/identification/index.md - Invitation Stage: flow/stages/invitation/index.md - OTP Stage: flow/stages/otp/index.md diff --git a/passbook/providers/oauth/settings.py b/passbook/providers/oauth/settings.py index bd04dd43e..f83a43279 100644 --- a/passbook/providers/oauth/settings.py +++ b/passbook/providers/oauth/settings.py @@ -24,10 +24,8 @@ OAUTH2_PROVIDER = { "SCOPES": { "openid": "Access OpenID Userinfo", "openid:userinfo": "Access OpenID Userinfo", - "email": "Access OpenID E-Mail", - # 'write': 'Write scope', - # 'groups': 'Access to your groups', - "user:email": "GitHub Compatibility: User E-Mail", + "email": "Access OpenID Email", + "user:email": "GitHub Compatibility: User Email", "read:org": "GitHub Compatibility: User Groups", } } diff --git a/passbook/stages/email/forms.py b/passbook/stages/email/forms.py index 7b65d7dad..03db70f4b 100644 --- a/passbook/stages/email/forms.py +++ b/passbook/stages/email/forms.py @@ -6,13 +6,13 @@ from passbook.stages.email.models import EmailStage class EmailStageSendForm(forms.Form): - """Form used when sending the e-mail to prevent multiple emails being sent""" + """Form used when sending the email to prevent multiple emails being sent""" invalid = forms.CharField(widget=forms.HiddenInput, required=True) class EmailStageForm(forms.ModelForm): - """Form to create/edit E-Mail Stage""" + """Form to create/edit Email Stage""" class Meta: diff --git a/passbook/stages/email/models.py b/passbook/stages/email/models.py index 4eef283df..bcdec174e 100644 --- a/passbook/stages/email/models.py +++ b/passbook/stages/email/models.py @@ -8,7 +8,7 @@ from passbook.flows.models import Stage class EmailTemplates(models.TextChoices): - """Templates used for rendering the E-Mail""" + """Templates used for rendering the Email""" PASSWORD_RESET = ( "stages/email/for_email/password_reset.html", diff --git a/passbook/stages/email/stage.py b/passbook/stages/email/stage.py index 705cc00e9..a93ab563e 100644 --- a/passbook/stages/email/stage.py +++ b/passbook/stages/email/stage.py @@ -22,7 +22,7 @@ QS_KEY_TOKEN = "token" class EmailStageView(FormView, StageView): - """E-Mail stage which sends E-Mail for verification""" + """Email stage which sends Email for verification""" form_class = EmailStageSendForm template_name = "stages/email/waiting_message.html" @@ -41,7 +41,7 @@ class EmailStageView(FormView, StageView): token = get_object_or_404(Token, pk=request.GET[QS_KEY_TOKEN]) self.executor.plan.context[PLAN_CONTEXT_PENDING_USER] = token.user token.delete() - messages.success(request, _("Successfully verified E-Mail.")) + messages.success(request, _("Successfully verified Email.")) return self.executor.stage_ok() return super().get(request, *args, **kwargs) diff --git a/passbook/stages/email/tasks.py b/passbook/stages/email/tasks.py index 750a5326e..846df7c55 100644 --- a/passbook/stages/email/tasks.py +++ b/passbook/stages/email/tasks.py @@ -27,7 +27,7 @@ def send_mails(stage: EmailStage, *messages: List[EmailMultiAlternatives]): ) # pylint: disable=unused-argument def _send_mail_task(self, email_stage_pk: int, message: Dict[Any, Any]): - """Send E-Mail according to EmailStage parameters from background worker. + """Send Email according to EmailStage parameters from background worker. Automatically retries if message couldn't be sent.""" stage: EmailStage = EmailStage.objects.get(pk=email_stage_pk) backend = stage.backend diff --git a/passbook/stages/email/templates/stages/email/for_email/password_reset.html b/passbook/stages/email/templates/stages/email/for_email/password_reset.html index e1d844032..4003b1e9c 100644 --- a/passbook/stages/email/templates/stages/email/for_email/password_reset.html +++ b/passbook/stages/email/templates/stages/email/for_email/password_reset.html @@ -33,7 +33,7 @@

{% blocktrans with expires=expires|naturaltime %} - If you did not request a password change, please ignore this E-Mail. The link above is valid for {{ expires }}. + If you did not request a password change, please ignore this Email. The link above is valid for {{ expires }}. {% endblocktrans %}

diff --git a/passbook/stages/email/templates/stages/email/waiting_message.html b/passbook/stages/email/templates/stages/email/waiting_message.html index bebfb7317..a1c0a2a64 100644 --- a/passbook/stages/email/templates/stages/email/waiting_message.html +++ b/passbook/stages/email/templates/stages/email/waiting_message.html @@ -7,7 +7,7 @@

{% blocktrans %} - Check your E-Mails for a password reset link. + Check your Emails for a password reset link. {% endblocktrans %}

{% csrf_token %} @@ -15,7 +15,7 @@ {% block beneath_form %} {% endblock %}
- +
{% endblock %} diff --git a/passbook/stages/identification/tests.py b/passbook/stages/identification/tests.py index f2d2835a8..37eb67c51 100644 --- a/passbook/stages/identification/tests.py +++ b/passbook/stages/identification/tests.py @@ -61,7 +61,7 @@ class TestIdentificationStage(TestCase): ) def test_invalid_with_username(self): - """Test invalid with username (user exists but stage only allows e-mail)""" + """Test invalid with username (user exists but stage only allows email)""" form_data = {"uid_field": self.user.username} response = self.client.post( reverse( @@ -72,7 +72,7 @@ class TestIdentificationStage(TestCase): self.assertEqual(response.status_code, 200) def test_invalid_with_invalid_email(self): - """Test with invalid e-mail (user doesn't exist) -> Will return to login form""" + """Test with invalid email (user doesn't exist) -> Will return to login form""" form_data = {"uid_field": self.user.email + "test"} response = self.client.post( reverse( diff --git a/passbook/stages/otp/views.py b/passbook/stages/otp/views.py index e933bedec..82ff8b333 100644 --- a/passbook/stages/otp/views.py +++ b/passbook/stages/otp/views.py @@ -110,7 +110,7 @@ class EnableView(LoginRequiredMixin, FormView): self.static_device = StaticDevice(user=request.user, confirmed=False) self.static_device.save() # Create 9 tokens and save them - # TODO: Send static tokens via E-Mail + # TODO: Send static tokens via Email for _counter in range(0, 9): token = StaticToken( device=self.static_device, token=StaticToken.random_token() diff --git a/passbook/stages/prompt/migrations/0004_auto_20200618_1735.py b/passbook/stages/prompt/migrations/0004_auto_20200618_1735.py new file mode 100644 index 000000000..6e12574a0 --- /dev/null +++ b/passbook/stages/prompt/migrations/0004_auto_20200618_1735.py @@ -0,0 +1,33 @@ +# Generated by Django 3.0.7 on 2020-06-18 17:35 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("passbook_stages_prompt", "0003_auto_20200615_1641"), + ] + + operations = [ + migrations.AlterField( + model_name="prompt", + name="type", + field=models.CharField( + choices=[ + ("text", "Text"), + ("username", "Username"), + ("email", "Email"), + ("password", "Password"), + ("number", "Number"), + ("checkbox", "Checkbox"), + ("data", "Date"), + ("data-time", "Date Time"), + ("separator", "Separator"), + ("hidden", "Hidden"), + ("static", "Static"), + ], + max_length=100, + ), + ), + ] diff --git a/passbook/stages/prompt/models.py b/passbook/stages/prompt/models.py index 616330d54..fbdf8835e 100644 --- a/passbook/stages/prompt/models.py +++ b/passbook/stages/prompt/models.py @@ -16,7 +16,7 @@ class FieldTypes(models.TextChoices): TEXT = "text" # Same as text, but has autocomplete for password managers USERNAME = "username" - EMAIL = "e-mail" + EMAIL = "email" PASSWORD = "password" # noqa # nosec NUMBER = "number" CHECKBOX = "checkbox" diff --git a/swagger.yaml b/swagger.yaml index 9c326a331..d36d86d3c 100755 --- a/swagger.yaml +++ b/swagger.yaml @@ -6080,7 +6080,7 @@ definitions: enum: - text - username - - e-mail + - email - password - number - checkbox