stages/otp_: ensure stage.configure_flow is set

This commit is contained in:
Jens Langhammer 2020-09-25 17:43:17 +02:00
parent 52101007aa
commit 84da454612
4 changed files with 10 additions and 2 deletions

View File

@ -29,6 +29,10 @@ def create_default_setup_flow(apps: Apps, schema_editor: BaseDatabaseSchemaEdito
target=flow, stage=stage, defaults={"order": 0}
)
for stage in OTPStaticStage.objects.using(db_alias).filter(configure_flow=None):
stage.configure_flow = flow
stage.save()
class Migration(migrations.Migration):

View File

@ -26,7 +26,7 @@
</ul>
{% if not state %}
{% if stage.configure_flow %}
<a href="{% url 'passbook-flows:configure' stage_uuid=stage.stage_uuid %}" class="pf-c-button pf-m-primary">{% trans "Enable Static Tokens" %}</a>
<a href="{% url 'passbook_flows:configure' stage_uuid=stage.stage_uuid %}" class="pf-c-button pf-m-primary">{% trans "Enable Static Tokens" %}</a>
{% endif %}
{% else %}
<a href="{% url 'passbook_stages_otp_static:disable' stage_uuid=stage.stage_uuid %}" class="pf-c-button pf-m-danger">{% trans "Disable Static Tokens" %}</a>

View File

@ -30,6 +30,10 @@ def create_default_setup_flow(apps: Apps, schema_editor: BaseDatabaseSchemaEdito
target=flow, stage=stage, defaults={"order": 0}
)
for stage in OTPTimeStage.objects.using(db_alias).filter(configure_flow=None):
stage.configure_flow = flow
stage.save()
class Migration(migrations.Migration):

View File

@ -22,7 +22,7 @@
<p>
{% if not state %}
{% if stage.configure_flow %}
<a href="{% url 'passbook-flows:configure' stage_uuid=stage.stage_uuid %}" class="pf-c-button pf-m-primary">{% trans "Enable Time-based OTP" %}</a>
<a href="{% url 'passbook_flows:configure' stage_uuid=stage.stage_uuid %}" class="pf-c-button pf-m-primary">{% trans "Enable Time-based OTP" %}</a>
{% endif %}
{% else %}
<a href="{% url 'passbook_stages_otp_time:disable' stage_uuid=stage.stage_uuid %}" class="pf-c-button pf-m-danger">{% trans "Disable Time-based OTP" %}</a>