Skip to content

Commit

Permalink
enhance(frontend): 2要素認証セットアップウィザードにアプリを起動するボタンを新設 (#13636)
Browse files Browse the repository at this point in the history
* enhance(frontend): 2要素認証セットアップウィザードにアプリを起動するボタンを新設

* add comment

* use css module
  • Loading branch information
kakkokari-gtyih authored Mar 30, 2024
1 parent 2a85143 commit 50da7d2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
10 changes: 5 additions & 5 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4928,6 +4928,10 @@ export interface Locale extends ILocale {
* バックアップコードを使う
*/
"useBackupCode": string;
/**
* アプリを起動
*/
"launchApp": string;
"_bubbleGame": {
/**
* 遊び方
Expand Down Expand Up @@ -7542,13 +7546,9 @@ export interface Locale extends ILocale {
*/
"step1": ParameterizedString<"a" | "b">;
/**
* 次に、表示されているQRコードをアプリでスキャンします
* 次に、表示されているQRコードをアプリでスキャンするか、ボタンをクリックして端末上でアプリを開きます
*/
"step2": string;
/**
* QRコードをクリックすると、お使いの端末にインストールされている認証アプリやキーリングに登録できます。
*/
"step2Click": string;
/**
* デスクトップアプリを使用する場合は次のURIを入力します
*/
Expand Down
4 changes: 2 additions & 2 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1228,6 +1228,7 @@ gameRetry: "リトライ"
notUsePleaseLeaveBlank: "使用しない場合は空欄にしてください"
useTotp: "ワンタイムパスワードを使う"
useBackupCode: "バックアップコードを使う"
launchApp: "アプリを起動"

_bubbleGame:
howToPlay: "遊び方"
Expand Down Expand Up @@ -1983,8 +1984,7 @@ _2fa:
alreadyRegistered: "既に設定は完了しています。"
registerTOTP: "認証アプリの設定を開始"
step1: "まず、{a}や{b}などの認証アプリをお使いのデバイスにインストールします。"
step2: "次に、表示されているQRコードをアプリでスキャンします。"
step2Click: "QRコードをクリックすると、お使いの端末にインストールされている認証アプリやキーリングに登録できます。"
step2: "次に、表示されているQRコードをアプリでスキャンするか、ボタンをクリックして端末上でアプリを開きます。"
step2Uri: "デスクトップアプリを使用する場合は次のURIを入力します"
step3Title: "確認コードを入力"
step3: "アプリに表示されている確認コード(トークン)を入力します。"
Expand Down
2 changes: 2 additions & 0 deletions packages/frontend/src/components/MkButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ SPDX-License-Identifier: AGPL-3.0-only
v-else class="_button"
:class="[$style.root, { [$style.inline]: inline, [$style.primary]: primary, [$style.gradate]: gradate, [$style.danger]: danger, [$style.rounded]: rounded, [$style.full]: full, [$style.small]: small, [$style.large]: large, [$style.transparent]: transparent, [$style.asLike]: asLike }]"
:to="to ?? '#'"
:behavior="linkBehavior"
@mousedown="onMousedown"
>
<div ref="ripples" :class="$style.ripples" :data-children-class="$style.ripple"></div>
Expand All @@ -43,6 +44,7 @@ const props = defineProps<{
inline?: boolean;
link?: boolean;
to?: string;
linkBehavior?: null | 'window' | 'browser';
autofocus?: boolean;
wait?: boolean;
danger?: boolean;
Expand Down
16 changes: 13 additions & 3 deletions packages/frontend/src/pages/settings/2fa.qrdialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ SPDX-License-Identifier: AGPL-3.0-only
<a href="https://support.google.com/accounts/answer/1066447" rel="noopener" target="_blank" class="_link">Google Authenticator</a>
</template>
</I18n>
<div>{{ i18n.ts._2fa.step2 }}<br>{{ i18n.ts._2fa.step2Click }}</div>
<a :href="twoFactorData.url"><img :class="$style.qr" :src="twoFactorData.qr"></a>
<div>{{ i18n.ts._2fa.step2 }}</div>
<div>
<a :class="$style.qrRoot" :href="twoFactorData.url"><img :class="$style.qr" :src="twoFactorData.qr"></a>
<!-- QRコード側にマージンが入っているので直下でOK -->
<div><MkButton inline rounded link :to="twoFactorData.url" :linkBehavior="'browser'">{{ i18n.ts.launchApp }}</MkButton></div>
</div>
<MkKeyValue :copy="twoFactorData.url">
<template #key>{{ i18n.ts._2fa.step2Uri }}</template>
<template #value>{{ twoFactorData.url }}</template>
Expand Down Expand Up @@ -177,8 +181,14 @@ function allDone() {
transform: translateX(-50px);
}
.qr {
.qrRoot {
display: block;
margin: 0 auto;
width: 200px;
max-width: 100%;
}
.qr {
width: 100%;
}
</style>

1 comment on commit 50da7d2

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chromatic detects changes. Please review the changes on Chromatic.

Please sign in to comment.