stages/identification: set primary_action based on flow designation

closes #3589

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-09-14 10:14:13 +02:00
parent dc622a836f
commit 6b8b596c92
3 changed files with 31 additions and 20 deletions

View File

@ -58,7 +58,7 @@ class AuthenticatorValidateStageTests(FlowTestCase):
flow,
component="ak-stage-identification",
password_fields=False,
primary_action="Log in",
primary_action="Continue",
user_fields=["username"],
sources=[],
show_source_labels=False,

View File

@ -21,6 +21,7 @@ from authentik.flows.challenge import (
ChallengeTypes,
RedirectChallenge,
)
from authentik.flows.models import FlowDesignation
from authentik.flows.planner import PLAN_CONTEXT_PENDING_USER
from authentik.flows.stage import PLAN_CONTEXT_PENDING_USER_IDENTIFIER, ChallengeStageView
from authentik.flows.views.executor import SESSION_KEY_APPLICATION_PRE, SESSION_KEY_GET
@ -165,12 +166,18 @@ class IdentificationStageView(ChallengeStageView):
return user
return None
def get_primary_action(self) -> str:
"""Get the primary action label for this stage"""
if self.executor.flow.designation == FlowDesignation.AUTHENTICATION:
return _("Log in")
return _("Continue")
def get_challenge(self) -> Challenge:
current_stage: IdentificationStage = self.executor.current_stage
challenge = IdentificationChallenge(
data={
"type": ChallengeTypes.NATIVE.value,
"primary_action": _("Log in"),
"primary_action": self.get_primary_action(),
"component": "ak-stage-identification",
"user_fields": current_stage.user_fields,
"password_fields": bool(current_stage.password_stage),

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-09-06 16:46+0000\n"
"POT-Creation-Date: 2022-09-14 08:12+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -18,7 +18,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: authentik/admin/api/tasks.py:99
#: authentik/admin/api/tasks.py:115
#, python-format
msgid "Successfully re-scheduled Task %(name)s!"
msgstr ""
@ -48,7 +48,7 @@ msgstr ""
msgid "authentik Export - %(date)s"
msgstr ""
#: authentik/blueprints/v1/tasks.py:104 authentik/crypto/tasks.py:93
#: authentik/blueprints/v1/tasks.py:106 authentik/crypto/tasks.py:93
#, python-format
msgid "Successfully imported %(count)d files."
msgstr ""
@ -246,25 +246,25 @@ msgstr ""
msgid "You're about to sign into %(application)s."
msgstr ""
#: authentik/crypto/api.py:143
#: authentik/crypto/api.py:144
msgid "Subject-alt name"
msgstr ""
#: authentik/crypto/models.py:35
#: authentik/crypto/models.py:30
msgid "PEM-encoded Certificate data"
msgstr ""
#: authentik/crypto/models.py:38
#: authentik/crypto/models.py:33
msgid ""
"Optional Private Key. If this is set, you can use this keypair for "
"encryption."
msgstr ""
#: authentik/crypto/models.py:107
#: authentik/crypto/models.py:102
msgid "Certificate-Key Pair"
msgstr ""
#: authentik/crypto/models.py:108
#: authentik/crypto/models.py:103
msgid "Certificate-Key Pairs"
msgstr ""
@ -859,20 +859,20 @@ msgstr ""
msgid "Redirecting to %(app)s..."
msgstr ""
#: authentik/providers/oauth2/views/userinfo.py:41
#: authentik/providers/oauth2/views/userinfo.py:42
#: authentik/providers/oauth2/views/userinfo.py:46
#: authentik/providers/oauth2/views/userinfo.py:47
msgid "GitHub Compatibility: Access your User Information"
msgstr ""
#: authentik/providers/oauth2/views/userinfo.py:43
#: authentik/providers/oauth2/views/userinfo.py:48
msgid "GitHub Compatibility: Access you Email addresses"
msgstr ""
#: authentik/providers/oauth2/views/userinfo.py:44
#: authentik/providers/oauth2/views/userinfo.py:49
msgid "GitHub Compatibility: Access your Groups"
msgstr ""
#: authentik/providers/oauth2/views/userinfo.py:45
#: authentik/providers/oauth2/views/userinfo.py:50
msgid "authentik API Access on behalf of your user"
msgstr ""
@ -1401,7 +1401,7 @@ msgstr ""
msgid "TOTP Authenticator Setup Stages"
msgstr ""
#: authentik/stages/authenticator_validate/challenge.py:115
#: authentik/stages/authenticator_validate/challenge.py:117
msgid "Invalid Token"
msgstr ""
@ -1647,10 +1647,14 @@ msgstr ""
msgid "Identification Stages"
msgstr ""
#: authentik/stages/identification/stage.py:173
#: authentik/stages/identification/stage.py:172
msgid "Log in"
msgstr ""
#: authentik/stages/identification/stage.py:173
msgid "Continue"
msgstr ""
#: authentik/stages/invitation/models.py:47
msgid "Invitation Stage"
msgstr ""
@ -1823,16 +1827,16 @@ msgstr ""
msgid "No Pending data."
msgstr ""
#: authentik/tenants/models.py:20
#: authentik/tenants/models.py:23
msgid ""
"Domain that activates this tenant. Can be a superset, i.e. `a.b` for `aa.b` "
"and `ba.b`"
msgstr ""
#: authentik/tenants/models.py:87
#: authentik/tenants/models.py:95
msgid "Tenant"
msgstr ""
#: authentik/tenants/models.py:88
#: authentik/tenants/models.py:96
msgid "Tenants"
msgstr ""