Add custom select-authenticator

This commit is contained in:
Oliver Traber 2023-02-21 21:54:02 +01:00
parent 2e612fc2ad
commit 47b0436b14
Signed by: Bluemedia
GPG key ID: C0674B105057136C
13 changed files with 227 additions and 55 deletions

View file

@ -84,6 +84,7 @@ import Layout from "~/components/Layout.vue";
import ErrorBox from "~/components/ErrorBox.vue";
import type { KcContextBase } from "~/types/context";
import { base64url } from "rfc4648";
import { formPost } from "~/functions/utils";
export default defineComponent({
name: "WebAuthnAuthenticate",
@ -106,7 +107,7 @@ export default defineComponent({
methods: {
tryAnotherWay(e: Event) {
e.preventDefault();
this.formPost(this.context.url.loginAction, {
formPost(this.context.url.loginAction, {
tryAnotherWay: "on",
});
},
@ -166,7 +167,7 @@ export default defineComponent({
),
};
this.formPost(this.context.url.loginAction, postData);
formPost(this.context.url.loginAction, postData);
} catch (err) {
this.error = true;
}
@ -174,24 +175,6 @@ export default defineComponent({
retryAuth() {
this.error = false;
},
formPost(url: string, data: object) {
const form = document.createElement("form");
form.method = "post";
form.action = url;
for (const key in data) {
if (Object.prototype.hasOwnProperty.call(data, key)) {
const hiddenField = document.createElement("input");
hiddenField.type = "hidden";
hiddenField.name = key;
hiddenField.value = data[key];
form.appendChild(hiddenField);
}
}
document.body.appendChild(form);
form.submit();
},
},
});
</script>