*: make email naming consistent
This commit is contained in:
parent
afc8baff5f
commit
5e8a1e3c0d
|
@ -15,7 +15,7 @@ nav:
|
||||||
- Stages:
|
- Stages:
|
||||||
- Captcha Stage: flow/stages/captcha/index.md
|
- Captcha Stage: flow/stages/captcha/index.md
|
||||||
- Dummy Stage: flow/stages/dummy/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
|
- Identification Stage: flow/stages/identification/index.md
|
||||||
- Invitation Stage: flow/stages/invitation/index.md
|
- Invitation Stage: flow/stages/invitation/index.md
|
||||||
- OTP Stage: flow/stages/otp/index.md
|
- OTP Stage: flow/stages/otp/index.md
|
||||||
|
|
|
@ -24,10 +24,8 @@ OAUTH2_PROVIDER = {
|
||||||
"SCOPES": {
|
"SCOPES": {
|
||||||
"openid": "Access OpenID Userinfo",
|
"openid": "Access OpenID Userinfo",
|
||||||
"openid:userinfo": "Access OpenID Userinfo",
|
"openid:userinfo": "Access OpenID Userinfo",
|
||||||
"email": "Access OpenID E-Mail",
|
"email": "Access OpenID Email",
|
||||||
# 'write': 'Write scope',
|
"user:email": "GitHub Compatibility: User Email",
|
||||||
# 'groups': 'Access to your groups',
|
|
||||||
"user:email": "GitHub Compatibility: User E-Mail",
|
|
||||||
"read:org": "GitHub Compatibility: User Groups",
|
"read:org": "GitHub Compatibility: User Groups",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,13 +6,13 @@ from passbook.stages.email.models import EmailStage
|
||||||
|
|
||||||
|
|
||||||
class EmailStageSendForm(forms.Form):
|
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)
|
invalid = forms.CharField(widget=forms.HiddenInput, required=True)
|
||||||
|
|
||||||
|
|
||||||
class EmailStageForm(forms.ModelForm):
|
class EmailStageForm(forms.ModelForm):
|
||||||
"""Form to create/edit E-Mail Stage"""
|
"""Form to create/edit Email Stage"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ from passbook.flows.models import Stage
|
||||||
|
|
||||||
|
|
||||||
class EmailTemplates(models.TextChoices):
|
class EmailTemplates(models.TextChoices):
|
||||||
"""Templates used for rendering the E-Mail"""
|
"""Templates used for rendering the Email"""
|
||||||
|
|
||||||
PASSWORD_RESET = (
|
PASSWORD_RESET = (
|
||||||
"stages/email/for_email/password_reset.html",
|
"stages/email/for_email/password_reset.html",
|
||||||
|
|
|
@ -22,7 +22,7 @@ QS_KEY_TOKEN = "token"
|
||||||
|
|
||||||
|
|
||||||
class EmailStageView(FormView, StageView):
|
class EmailStageView(FormView, StageView):
|
||||||
"""E-Mail stage which sends E-Mail for verification"""
|
"""Email stage which sends Email for verification"""
|
||||||
|
|
||||||
form_class = EmailStageSendForm
|
form_class = EmailStageSendForm
|
||||||
template_name = "stages/email/waiting_message.html"
|
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])
|
token = get_object_or_404(Token, pk=request.GET[QS_KEY_TOKEN])
|
||||||
self.executor.plan.context[PLAN_CONTEXT_PENDING_USER] = token.user
|
self.executor.plan.context[PLAN_CONTEXT_PENDING_USER] = token.user
|
||||||
token.delete()
|
token.delete()
|
||||||
messages.success(request, _("Successfully verified E-Mail."))
|
messages.success(request, _("Successfully verified Email."))
|
||||||
return self.executor.stage_ok()
|
return self.executor.stage_ok()
|
||||||
return super().get(request, *args, **kwargs)
|
return super().get(request, *args, **kwargs)
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ def send_mails(stage: EmailStage, *messages: List[EmailMultiAlternatives]):
|
||||||
)
|
)
|
||||||
# pylint: disable=unused-argument
|
# pylint: disable=unused-argument
|
||||||
def _send_mail_task(self, email_stage_pk: int, message: Dict[Any, Any]):
|
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."""
|
Automatically retries if message couldn't be sent."""
|
||||||
stage: EmailStage = EmailStage.objects.get(pk=email_stage_pk)
|
stage: EmailStage = EmailStage.objects.get(pk=email_stage_pk)
|
||||||
backend = stage.backend
|
backend = stage.backend
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
</table>
|
</table>
|
||||||
<p>
|
<p>
|
||||||
{% blocktrans with expires=expires|naturaltime %}
|
{% 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 %}
|
{% endblocktrans %}
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<form method="POST" class="pf-c-form">
|
<form method="POST" class="pf-c-form">
|
||||||
<p>
|
<p>
|
||||||
{% blocktrans %}
|
{% blocktrans %}
|
||||||
Check your E-Mails for a password reset link.
|
Check your Emails for a password reset link.
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
</p>
|
</p>
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
{% block beneath_form %}
|
{% block beneath_form %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
<div class="pf-c-form__group pf-m-action">
|
<div class="pf-c-form__group pf-m-action">
|
||||||
<button class="pf-c-button pf-m-primary pf-m-block" type="submit">{% trans "Send Recovery E-Mail." %}</button>
|
<button class="pf-c-button pf-m-primary pf-m-block" type="submit">{% trans "Send Recovery Email." %}</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -61,7 +61,7 @@ class TestIdentificationStage(TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_invalid_with_username(self):
|
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}
|
form_data = {"uid_field": self.user.username}
|
||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
reverse(
|
reverse(
|
||||||
|
@ -72,7 +72,7 @@ class TestIdentificationStage(TestCase):
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
def test_invalid_with_invalid_email(self):
|
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"}
|
form_data = {"uid_field": self.user.email + "test"}
|
||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
reverse(
|
reverse(
|
||||||
|
|
|
@ -110,7 +110,7 @@ class EnableView(LoginRequiredMixin, FormView):
|
||||||
self.static_device = StaticDevice(user=request.user, confirmed=False)
|
self.static_device = StaticDevice(user=request.user, confirmed=False)
|
||||||
self.static_device.save()
|
self.static_device.save()
|
||||||
# Create 9 tokens and save them
|
# 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):
|
for _counter in range(0, 9):
|
||||||
token = StaticToken(
|
token = StaticToken(
|
||||||
device=self.static_device, token=StaticToken.random_token()
|
device=self.static_device, token=StaticToken.random_token()
|
||||||
|
|
|
@ -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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
|
@ -16,7 +16,7 @@ class FieldTypes(models.TextChoices):
|
||||||
TEXT = "text"
|
TEXT = "text"
|
||||||
# Same as text, but has autocomplete for password managers
|
# Same as text, but has autocomplete for password managers
|
||||||
USERNAME = "username"
|
USERNAME = "username"
|
||||||
EMAIL = "e-mail"
|
EMAIL = "email"
|
||||||
PASSWORD = "password" # noqa # nosec
|
PASSWORD = "password" # noqa # nosec
|
||||||
NUMBER = "number"
|
NUMBER = "number"
|
||||||
CHECKBOX = "checkbox"
|
CHECKBOX = "checkbox"
|
||||||
|
|
|
@ -6080,7 +6080,7 @@ definitions:
|
||||||
enum:
|
enum:
|
||||||
- text
|
- text
|
||||||
- username
|
- username
|
||||||
- e-mail
|
- email
|
||||||
- password
|
- password
|
||||||
- number
|
- number
|
||||||
- checkbox
|
- checkbox
|
||||||
|
|
Reference in New Issue