flows/stages/consent: fix for post requests (#3339)
add unique token to consent stage to ensure it is shown Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
@ -23,17 +23,19 @@ export function readFileAsync(file: Blob) {
|
||||
});
|
||||
}
|
||||
|
||||
export type KeyUnknown = {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
|
||||
export class BaseStage<Tin, Tout> extends LitElement {
|
||||
host!: StageHost;
|
||||
|
||||
@property({ attribute: false })
|
||||
challenge!: Tin;
|
||||
|
||||
async submitForm(e: Event): Promise<boolean> {
|
||||
async submitForm(e: Event, defaults?: KeyUnknown): Promise<boolean> {
|
||||
e.preventDefault();
|
||||
const object: {
|
||||
[key: string]: unknown;
|
||||
} = {};
|
||||
const object: KeyUnknown = defaults || {};
|
||||
const form = new FormData(this.shadowRoot?.querySelector("form") || undefined);
|
||||
|
||||
for await (const [key, value] of form.entries()) {
|
||||
|
@ -107,7 +107,9 @@ export class ConsentStage extends BaseStage<ConsentChallenge, ConsentChallengeRe
|
||||
<form
|
||||
class="pf-c-form"
|
||||
@submit=${(e: Event) => {
|
||||
this.submitForm(e);
|
||||
this.submitForm(e, {
|
||||
token: this.challenge.token,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<ak-form-static
|
||||
|
Reference in New Issue
Block a user