web/admin: fix empty request being sent due to multiple forms in duo import modal

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-11-24 12:08:06 +01:00
parent 0813a49ca5
commit 474677017f
1 changed files with 26 additions and 30 deletions

View File

@ -42,15 +42,14 @@ export class DuoDeviceImportForm extends ModelForm<AuthenticatorDuoStage, string
};
renderForm(): TemplateResult {
return html`${this.instance?.adminIntegrationKey !== ""
? this.renderFormAutomatic()
: html``}
${this.renderFormManual()}`;
return html` <form class="pf-c-form pf-m-horizontal">
${this.instance?.adminIntegrationKey !== "" ? this.renderFormAutomatic() : html``}
${this.renderFormManual()}
</form>`;
}
renderFormManual(): TemplateResult {
return html`<form class="pf-c-form pf-m-horizontal">
<ak-form-element-horizontal label=${t`User`} ?required=${true} name="username">
return html`<ak-form-element-horizontal label=${t`User`} ?required=${true} name="username">
<select class="pf-c-form-control">
${until(
new CoreApi(DEFAULT_CONFIG)
@ -76,13 +75,11 @@ export class DuoDeviceImportForm extends ModelForm<AuthenticatorDuoStage, string
<p class="pf-c-form__helper-text">
${t`The user ID in Duo, can be found in the URL after clicking on a user.`}
</p>
</ak-form-element-horizontal>
</form>`;
</ak-form-element-horizontal>`;
}
renderFormAutomatic(): TemplateResult {
return html`
<form class="pf-c-form pf-m-horizontal">
<ak-form-element-horizontal label=${t`Automatic import`}>
<ak-action-button
class="pf-m-primary"
@ -104,7 +101,6 @@ export class DuoDeviceImportForm extends ModelForm<AuthenticatorDuoStage, string
${t`Start automatic import`}
</ak-action-button>
</ak-form-element-horizontal>
</form>
<ak-divider>${t`Or manually import`}</ak-divider>
<br />
`;