diff options
| author | かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> | 2024-10-04 15:23:33 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-04 15:23:33 +0900 |
| commit | 975c2e7bc567618c3f8b0082afcba6530d679dae (patch) | |
| tree | 2268801e42af4285f851b08077bbe9d569755156 /packages/frontend/src/components/MkSignin.passkey.vue | |
| parent | Update generate.tsx (diff) | |
| download | misskey-975c2e7bc567618c3f8b0082afcba6530d679dae.tar.gz misskey-975c2e7bc567618c3f8b0082afcba6530d679dae.tar.bz2 misskey-975c2e7bc567618c3f8b0082afcba6530d679dae.zip | |
enhance(frontend): サインイン画面の改善 (#14658)
* wip
* Update MkSignin.vue
* Update MkSignin.vue
* wip
* Update CHANGELOG.md
* enhance(frontend): サインイン画面の改善
* Update Changelog
* 14655の変更取り込み
* spdx
* fix
* fix
* fix
* :art:
* :art:
* :art:
* :art:
* Captchaがリセットされない問題を修正
* 次の処理をsignin apiから読み取るように
* Add Comments
* fix
* fix test
* attempt to fix test
* fix test
* fix test
* fix test
* fix
* fix test
* fix: 一部のエラーがちゃんと出るように
* Update Changelog
* :art:
* :art:
* remove border
---------
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Diffstat (limited to 'packages/frontend/src/components/MkSignin.passkey.vue')
| -rw-r--r-- | packages/frontend/src/components/MkSignin.passkey.vue | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/packages/frontend/src/components/MkSignin.passkey.vue b/packages/frontend/src/components/MkSignin.passkey.vue new file mode 100644 index 0000000000..0d68955fab --- /dev/null +++ b/packages/frontend/src/components/MkSignin.passkey.vue @@ -0,0 +1,92 @@ +<!-- +SPDX-FileCopyrightText: syuilo and misskey-project +SPDX-License-Identifier: AGPL-3.0-only +--> + +<template> +<div :class="$style.wrapper"> + <div class="_gaps" :class="$style.root"> + <div class="_gaps_s"> + <div :class="$style.passkeyIcon"> + <i class="ti ti-fingerprint"></i> + </div> + <div :class="$style.passkeyDescription">{{ i18n.ts.useSecurityKey }}</div> + </div> + + <MkButton large primary rounded :disabled="queryingKey" style="margin: 0 auto;" @click="queryKey">{{ i18n.ts.retry }}</MkButton> + + <MkButton v-if="isPerformingPasswordlessLogin !== true" transparent rounded :disabled="queryingKey" style="margin: 0 auto;" @click="emit('useTotp')">{{ i18n.ts.useTotp }}</MkButton> + </div> +</div> +</template> + +<script setup lang="ts"> +import { ref, onMounted } from 'vue'; +import { get as webAuthnRequest } from '@github/webauthn-json/browser-ponyfill'; + +import { i18n } from '@/i18n.js'; + +import MkButton from '@/components/MkButton.vue'; + +import type { AuthenticationPublicKeyCredential } from '@github/webauthn-json/browser-ponyfill'; + +const props = defineProps<{ + credentialRequest: CredentialRequestOptions; + isPerformingPasswordlessLogin?: boolean; +}>(); + +const emit = defineEmits<{ + (ev: 'done', credential: AuthenticationPublicKeyCredential): void; + (ev: 'useTotp'): void; +}>(); + +const queryingKey = ref(true); + +async function queryKey() { + queryingKey.value = true; + await webAuthnRequest(props.credentialRequest) + .catch(() => { + return Promise.reject(null); + }) + .then((credential) => { + emit('done', credential); + }) + .finally(() => { + queryingKey.value = false; + }); +} + +onMounted(() => { + queryKey(); +}); +</script> + +<style lang="scss" module> +.wrapper { + display: flex; + align-items: center; + width: 100%; + min-height: 336px; + + > .root { + width: 100%; + } +} + +.passkeyIcon { + margin: 0 auto; + background-color: var(--accentedBg); + color: var(--accent); + text-align: center; + height: 64px; + width: 64px; + font-size: 24px; + line-height: 64px; + border-radius: 50%; +} + +.passkeyDescription { + text-align: center; + font-size: 1.1em; +} +</style> |