web/admin: fix authenticatior_valiation stage not setting correct fields

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-06-09 19:38:54 +02:00
parent d4379ecd31
commit 7834146efc
1 changed files with 22 additions and 22 deletions

View File

@ -16,13 +16,13 @@ export class AuthenticatorValidateStageForm extends ModelForm<AuthenticatorValid
return new StagesApi(DEFAULT_CONFIG).stagesAuthenticatorValidateRetrieve({
stageUuid: pk,
}).then(stage => {
this.showConfigureFlow = stage.notConfiguredAction === NotConfiguredActionEnum.Configure;
this.showConfigurationStage = stage.notConfiguredAction === NotConfiguredActionEnum.Configure;
return stage;
});
}
@property({ type: Boolean })
showConfigureFlow = false;
showConfigurationStage = true;
getSuccessMessage(): string {
if (this.instance) {
@ -74,9 +74,9 @@ export class AuthenticatorValidateStageForm extends ModelForm<AuthenticatorValid
<select class="pf-c-form-control" @change=${(ev: Event) => {
const target = ev.target as HTMLSelectElement;
if (target.selectedOptions[0].value === NotConfiguredActionEnum.Configure) {
this.showConfigureFlow = true;
this.showConfigurationStage = true;
} else {
this.showConfigureFlow = false;
this.showConfigurationStage = false;
}
}}>
<option value=${NotConfiguredActionEnum.Configure} ?selected=${this.instance?.notConfiguredAction === NotConfiguredActionEnum.Configure}>
@ -111,24 +111,24 @@ export class AuthenticatorValidateStageForm extends ModelForm<AuthenticatorValid
<p class="pf-c-form__helper-text">${t`Device classes which can be used to authenticate.`}</p>
<p class="pf-c-form__helper-text">${t`Hold control/command to select multiple items.`}</p>
</ak-form-element-horizontal>
${this.showConfigureFlow ? html`
<ak-form-element-horizontal
label=${t`Configuration flow`}
?required=${true}
name="configureFlow">
<select class="pf-c-form-control">
<option value="" ?selected=${this.instance?.configurationStage === undefined}>---------</option>
${until(new StagesApi(DEFAULT_CONFIG).stagesAllList({
ordering: "pk",
}).then(stages => {
return stages.results.map(stage => {
const selected = this.instance?.configurationStage === stage.pk;
return html`<option value=${ifDefined(stage.pk)} ?selected=${selected}>${stage.name} (${stage.verboseName})</option>`;
});
}), html`<option>${t`Loading...`}</option>`)}
</select>
<p class="pf-c-form__helper-text">${t`Stage used to configure Authenticator when user doesn't have any compatible devices. After this configuration Stage passes, the user is not prompted again.`}</p>
</ak-form-element-horizontal>
${this.showConfigurationStage ? html`
<ak-form-element-horizontal
label=${t`Configuration stage`}
?required=${true}
name="configurationStage">
<select class="pf-c-form-control">
<option value="" ?selected=${this.instance?.configurationStage === undefined}>---------</option>
${until(new StagesApi(DEFAULT_CONFIG).stagesAllList({
ordering: "pk",
}).then(stages => {
return stages.results.map(stage => {
const selected = this.instance?.configurationStage === stage.pk;
return html`<option value=${ifDefined(stage.pk)} ?selected=${selected}>${stage.name} (${stage.verboseName})</option>`;
});
}), html`<option>${t`Loading...`}</option>`)}
</select>
<p class="pf-c-form__helper-text">${t`Stage used to configure Authenticator when user doesn't have any compatible devices. After this configuration Stage passes, the user is not prompted again.`}</p>
</ak-form-element-horizontal>
`: html``}
</div>
</ak-form-group>