stages/password: adjust name of default prompt stage
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
2a90c0b35e
commit
bff7addb55
|
@ -27,7 +27,7 @@ def create_default_password_change(apps: Apps, schema_editor: BaseDatabaseSchema
|
|||
)
|
||||
|
||||
prompt_stage, _ = PromptStage.objects.using(db_alias).update_or_create(
|
||||
name="Change your password",
|
||||
name="default-password-change-prompt",
|
||||
)
|
||||
password_prompt, _ = Prompt.objects.using(db_alias).update_or_create(
|
||||
field_key="password",
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
# Generated by Django 3.2.5 on 2021-08-21 13:12
|
||||
from django.apps.registry import Apps
|
||||
from django.db import migrations
|
||||
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
|
||||
|
||||
|
||||
def rename_default_prompt_stage(apps: Apps, schema_editor: BaseDatabaseSchemaEditor):
|
||||
PromptStage = apps.get_model("authentik_stages_prompt", "PromptStage")
|
||||
db_alias = schema_editor.connection.alias
|
||||
|
||||
stages = PromptStage.objects.using(db_alias).filter(name="Change your password")
|
||||
if not stages.exists():
|
||||
return
|
||||
stage = stages.first()
|
||||
stage.name = "default-password-change-prompt"
|
||||
stage.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("authentik_stages_password", "0005_auto_20210402_2221"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(rename_default_prompt_stage),
|
||||
]
|
Reference in New Issue