revert more debugging stuff
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
@ -1,12 +1,20 @@
|
|||||||
import { fromByteArray } from "base64-js";
|
import { fromByteArray } from "base64-js";
|
||||||
// import "formdata-polyfill";
|
import "formdata-polyfill";
|
||||||
import $ from "jquery";
|
import $ from "jquery";
|
||||||
import "weakmap-polyfill";
|
import "weakmap-polyfill";
|
||||||
|
|
||||||
|
import {
|
||||||
|
type AuthenticatorValidationChallenge,
|
||||||
import { type AuthenticatorValidationChallenge, type AutosubmitChallenge, type ChallengeTypes, ChallengeTypesFromJSON, type ContextualFlowInfo, type DeviceChallenge, type ErrorDetail, type IdentificationChallenge, type PasswordChallenge, type RedirectChallenge } from "@goauthentik/api";
|
type AutosubmitChallenge,
|
||||||
|
type ChallengeTypes,
|
||||||
|
ChallengeTypesFromJSON,
|
||||||
|
type ContextualFlowInfo,
|
||||||
|
type DeviceChallenge,
|
||||||
|
type ErrorDetail,
|
||||||
|
type IdentificationChallenge,
|
||||||
|
type PasswordChallenge,
|
||||||
|
type RedirectChallenge,
|
||||||
|
} from "@goauthentik/api";
|
||||||
|
|
||||||
interface GlobalAuthentik {
|
interface GlobalAuthentik {
|
||||||
brand: {
|
brand: {
|
||||||
@ -59,17 +67,15 @@ class SimpleFlowExecutor {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
submit(data: { [key: string]: unknown } | HTMLFormElement) {
|
submit(data: { [key: string]: unknown } | FormData) {
|
||||||
$("button[type=submit]").addClass("disabled")
|
$("button[type=submit]").addClass("disabled")
|
||||||
.html(`<span class="spinner-border spinner-border-sm" aria-hidden="true"></span>
|
.html(`<span class="spinner-border spinner-border-sm" aria-hidden="true"></span>
|
||||||
<span id="loading-text" role="status">Loading...</span>`);
|
<span role="status">Loading...</span>`);
|
||||||
let finalData: { [key: string]: unknown } = {};
|
let finalData: { [key: string]: unknown } = {};
|
||||||
if (data.tagName === "FORM") {
|
if (data instanceof FormData) {
|
||||||
// @ts-expect-error
|
finalData = {};
|
||||||
const rawData = $(data as unknown as string).serializeArray();
|
data.forEach((value, key) => {
|
||||||
|
finalData[key] = value;
|
||||||
rawData.forEach((entry) => {
|
|
||||||
finalData[entry.name] = entry.value;
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
finalData = data;
|
finalData = data;
|
||||||
@ -192,7 +198,8 @@ class IdentificationStage extends Stage<IdentificationChallenge> {
|
|||||||
$("#ident-form input[name=uid_field]").trigger("focus");
|
$("#ident-form input[name=uid_field]").trigger("focus");
|
||||||
$("#ident-form").on("submit", (ev) => {
|
$("#ident-form").on("submit", (ev) => {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
this.executor.submit(ev.target as HTMLFormElement);
|
const data = new FormData(ev.target as HTMLFormElement);
|
||||||
|
this.executor.submit(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -215,7 +222,8 @@ class PasswordStage extends Stage<PasswordChallenge> {
|
|||||||
$("#password-form input").trigger("focus");
|
$("#password-form input").trigger("focus");
|
||||||
$("#password-form").on("submit", (ev) => {
|
$("#password-form").on("submit", (ev) => {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
this.executor.submit(ev.target as HTMLFormElement);
|
const data = new FormData(ev.target as HTMLFormElement);
|
||||||
|
this.executor.submit(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -477,7 +485,8 @@ class AuthenticatorValidateStage extends Stage<AuthenticatorValidationChallenge>
|
|||||||
$("#totp-form input").trigger("focus");
|
$("#totp-form input").trigger("focus");
|
||||||
$("#totp-form").on("submit", (ev) => {
|
$("#totp-form").on("submit", (ev) => {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
this.executor.submit(ev.target as HTMLFormElement);
|
const data = new FormData(ev.target as HTMLFormElement);
|
||||||
|
this.executor.submit(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user