Skip to content

Commit ef9d27a

Browse files
authored
Merge pull request #702 from devforth/feature/AdminForth/1800/add-docs-for-https-github
fix: add documentation for TOTP setup and login validity period
2 parents b700797 + 8aac6c9 commit ef9d27a

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,24 @@ If you want to have custom label prefix for some reason:
672672
],
673673
```
674674
675+
## TOTP setup / login validity period
676+
677+
When a user logs in with password, the plugin issues a short-lived temporary login session (stored in a cookie) during which the user must either complete the initial 2FA setup (scan the QR code and enter the code) or enter the OTP code. By default this session lives only **1 minute**.
678+
679+
If your users don't have enough time to scan the QR code and enter the code (or you simply want a more relaxed flow), you can increase it with the `totpSetupValidityPeriod` option:
680+
681+
```ts title='./adminuser.ts'
682+
new TwoFactorsAuthPlugin ({
683+
twoFaSecretFieldName: 'secret2fa',
684+
...
685+
//diff-add
686+
totpSetupValidityPeriod: '5m', // e.g. '5m', '10m', '15m'. Default is '1m'
687+
...
688+
}),
689+
```
690+
691+
This value controls both the lifetime of the temporary login JWT and the expiry of the temporary cookie, so they stay in sync.
692+
675693
## Passkeys setup (WebAuthn) alongside TOTP
676694
677695
If you want to use both passkeys and TOTP simultaneously, you can set them up as follows:

0 commit comments

Comments
 (0)