mirror of
https://github.com/dani-garcia/vaultwarden.wiki.git
synced 2026-11-03 17:46:47 +02:00
Make 2FA remember duration configurable (#7421)
This commit is contained in:
3 files changed
+14
-1
No files matched your search
@@ -736,6 +736,8 @@ make_config! {
|
||||
/// Disable Two-Factor remember |> Enabling this would force the users to use a second factor to login every time.
|
||||
/// Note that the checkbox would still be present, but ignored.
|
||||
disable_2fa_remember: bool, true, def, false;
|
||||
/// Two-Factor remember duration |> Number of days before a remembered Two-Factor login expires (min: 1, max: 90).
|
||||
two_factor_remember_days: i64, true, def, 30;
|
||||
|
||||
/// Disable authenticator time drifted codes to be valid |> Enabling this only allows the current TOTP code to be valid
|
||||
/// TOTP codes of the previous and next 30 seconds will be invalid.
|
||||
@@ -1275,6 +1277,10 @@ fn validate_config(cfg: &ConfigItems, on_update: bool) -> Result<(), Error> {
|
||||
err!("`INVITATION_EXPIRATION_HOURS` has a minimum duration of 1 hour")
|
||||
}
|
||||
|
||||
if !(1..=90).contains(&cfg.two_factor_remember_days) {
|
||||
err!("`TWO_FACTOR_REMEMBER_DAYS` must be between 1 and 90 days")
|
||||
}
|
||||
|
||||
// Validate schedule crontab format
|
||||
if !cfg.send_purge_schedule.is_empty() && cfg.send_purge_schedule.parse::<Schedule>().is_err() {
|
||||
err!("`SEND_PURGE_SCHEDULE` is not a valid cron expression")
|
||||
|
||||
Reference in new issue
Block a user