Skip to content

Commit

Permalink
feat: show secret in 2fa page (close AlistGo/alist#4555)
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Jun 11, 2023
1 parent cd637a7 commit ec3ed82
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/lang/en/users.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"cancel_2fa_success": "Cancel 2FA successfully",
"2fa_already_enabled": "2FA is already enabled",
"scan_qr": "Scan the QR code to save the secret key",
"or_manual": "Or input the secret key manually",
"input_code": "Input the code of your 2FA app",
"verify": "Verify",
"guest-tips": "You are currently visiting as a guest.",
Expand Down
8 changes: 6 additions & 2 deletions src/pages/manage/users/2fa.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Button, Heading, Image, Input, VStack } from "@hope-ui/solid"
import { Button, Heading, Image, Input, Text, VStack } from "@hope-ui/solid"
import { createSignal, Show } from "solid-js"
import { MaybeLoading } from "~/components"
import { useRouter, useFetch, useT } from "~/hooks"
import { setMe, me } from "~/store"
import { setMe, me, getMainColor } from "~/store"
import { PEmptyResp, PResp } from "~/types"
import { handleResp, handleRespWithNotifySuccess, notify, r } from "~/utils"

Expand Down Expand Up @@ -49,6 +49,10 @@ const TwoFA = () => {
<VStack spacing="$2" alignItems="start">
<Heading>{t("users.scan_qr")}</Heading>
<Image boxSize="$xs" rounded="$lg" src={otpData()?.qr} />
<Heading>
{t("users.or_manual")}:{" "}
<Text color={getMainColor()}>{otpData()?.secret}</Text>
</Heading>
<Input
maxW="$xs"
placeholder={t("users.input_code")}
Expand Down

0 comments on commit ec3ed82

Please sign in to comment.