Skip to content

Commit 045d2b9

Browse files
committed
docs: update docs for the 2fa
AdminForth/1683/update-docs-for-passkeys.-need
1 parent b38a8a4 commit 045d2b9

1 file changed

Lines changed: 92 additions & 20 deletions

File tree

adminforth/documentation/docs/tutorial/09-Plugins/02-TwoFactorsAuth.md

Lines changed: 92 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: Two-Factor Authentication Plugin
33
description: "Guide to the Two-Factor Authentication plugin, including installation, TOTP or passkey setup, rollout rules, and per-user exceptions for stronger admin login security."
44
slug: /tutorial/Plugins/two-factors-auth
55
---
6+
import Tabs from '@theme/Tabs';
7+
import TabItem from '@theme/TabItem';
68

79
# Two-Factor Authentication Plugin
810

@@ -667,27 +669,97 @@ If you want to have custom label prefix for some reason:
667669
If you want to use both passkeys and TOTP simultaneously, you can set them up as follows:
668670
669671
First, you need to create a passkeys table in your schema.prisma file:
672+
<Tabs
673+
defaultValue="sqlite"
674+
values={[
675+
{label: 'SQlite', value: 'sqlite'},
676+
{label: 'Postgres', value: 'postgres'},
677+
{label: 'MySql', value: 'mysql'},
678+
{label: 'Clickhouse', value: 'clickhouse'},
679+
]}>
680+
<TabItem value="sqlite">
681+
```ts title='./schema.prisma'
682+
//diff-add
683+
model passkeys {
684+
//diff-add
685+
id String @id
686+
//diff-add
687+
credential_id String
688+
//diff-add
689+
user_id String
690+
//diff-add
691+
meta String
692+
//diff-add
693+
@@index([user_id])
694+
//diff-add
695+
@@index([credential_id])
696+
//diff-add
697+
}
698+
```
699+
</TabItem>
700+
<TabItem value="postgres">
701+
```ts title='./schema.prisma'
702+
//diff-add
703+
model passkeys {
704+
//diff-add
705+
id String @id
706+
//diff-add
707+
credential_id String
708+
//diff-add
709+
user_id String
710+
//diff-add
711+
meta Json
712+
//diff-add
713+
@@index([user_id])
714+
//diff-add
715+
@@index([credential_id])
716+
//diff-add
717+
}
718+
```
719+
</TabItem>
720+
<TabItem value="mysql">
721+
```ts title='./schema.prisma'
722+
//diff-add
723+
model passkeys {
724+
//diff-add
725+
id String @id
726+
//diff-add
727+
credential_id String
728+
//diff-add
729+
user_id String
730+
//diff-add
731+
meta Json
732+
//diff-add
733+
@@index([user_id])
734+
//diff-add
735+
@@index([credential_id])
736+
//diff-add
737+
}
738+
```
739+
</TabItem>
740+
<TabItem value="clickhouse">
741+
```ts title='./schema.prisma'
742+
//diff-add
743+
model passkeys {
744+
//diff-add
745+
id String @id
746+
//diff-add
747+
credential_id String
748+
//diff-add
749+
user_id String
750+
//diff-add
751+
meta Json
752+
//diff-add
753+
@@index([user_id])
754+
//diff-add
755+
@@index([credential_id])
756+
//diff-add
757+
}
758+
```
759+
</TabItem>
760+
</Tabs>
670761
671-
```ts title='./schema.prisma'
672-
//diff-add
673-
model passkeys {
674-
//diff-add
675-
id String @id
676-
//diff-add
677-
credential_id String
678-
//diff-add
679-
user_id String
680-
//diff-add
681-
meta String
682-
//diff-add
683-
@@index([user_id])
684-
//diff-add
685-
@@index([credential_id])
686-
//diff-add
687-
}
688-
```
689-
>☝️Use string data type for credential_id and meta fields
690-
762+
>☝️Use Json data type, if it's possible for the meta field
691763
And make migration:
692764
693765
```bash

0 commit comments

Comments
 (0)