Focus username field on load
This commit is contained in:
parent
627cfe6462
commit
410a09aec6
|
@ -29,6 +29,7 @@
|
||||||
<input
|
<input
|
||||||
name="username"
|
name="username"
|
||||||
type="text"
|
type="text"
|
||||||
|
ref="focus"
|
||||||
:placeholder="
|
:placeholder="
|
||||||
context.realm.loginWithEmailAllowed
|
context.realm.loginWithEmailAllowed
|
||||||
? 'jane.doe@example.com'
|
? 'jane.doe@example.com'
|
||||||
|
@ -80,7 +81,7 @@
|
||||||
</layout>
|
</layout>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent } from "vue";
|
import { defineComponent, ref, onMounted, nextTick } from "vue";
|
||||||
import Layout from "~/components/Layout.vue";
|
import Layout from "~/components/Layout.vue";
|
||||||
import ErrorBox from "~/components/ErrorBox.vue";
|
import ErrorBox from "~/components/ErrorBox.vue";
|
||||||
import type { KcContextBase } from "~/types/context";
|
import type { KcContextBase } from "~/types/context";
|
||||||
|
@ -96,6 +97,19 @@ export default defineComponent({
|
||||||
context: (window as any).kcContext as KcContextBase.Login,
|
context: (window as any).kcContext as KcContextBase.Login,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
setup() {
|
||||||
|
const focus = ref(null);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
nextTick(() => {
|
||||||
|
focus.value.focus();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
focus,
|
||||||
|
};
|
||||||
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
|
|
@ -115,9 +115,7 @@ export default defineComponent({
|
||||||
this.authenticate([]);
|
this.authenticate([]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async authenticate(
|
async authenticate(allowedAuthenticators: PublicKeyCredentialDescriptor[]) {
|
||||||
allowedAuthenticators: PublicKeyCredentialDescriptor[]
|
|
||||||
) {
|
|
||||||
const publicKey: PublicKeyCredentialRequestOptions = {
|
const publicKey: PublicKeyCredentialRequestOptions = {
|
||||||
rpId: this.context.rpId,
|
rpId: this.context.rpId,
|
||||||
challenge: base64url.parse(this.context.challenge, { loose: true }),
|
challenge: base64url.parse(this.context.challenge, { loose: true }),
|
||||||
|
|
Loading…
Reference in a new issue