Browse Source

Lower maximum 2FA remember duration to 365 days

pull/7421/head
Tom 1 week ago
parent
commit
f60c30fd41
  1. 2
      .env.template
  2. 6
      src/config.rs

2
.env.template

@ -587,7 +587,7 @@
## Note that the checkbox would still be present, but ignored. ## Note that the checkbox would still be present, but ignored.
# DISABLE_2FA_REMEMBER=false # DISABLE_2FA_REMEMBER=false
## ##
## Number of days before a remembered 2FA login expires (min: 1, max: 3650). ## Number of days before a remembered 2FA login expires (min: 1, max: 365).
# TWO_FACTOR_REMEMBER_DAYS=30 # TWO_FACTOR_REMEMBER_DAYS=30
## ##
## Authenticator Settings ## Authenticator Settings

6
src/config.rs

@ -705,7 +705,7 @@ make_config! {
/// Disable Two-Factor remember |> Enabling this would force the users to use a second factor to login every time. /// 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. /// Note that the checkbox would still be present, but ignored.
disable_2fa_remember: bool, true, def, false; disable_2fa_remember: bool, true, def, false;
/// Two-Factor remember duration |> Number of days before a remembered Two-Factor login expires (min: 1, max: 3650). /// Two-Factor remember duration |> Number of days before a remembered Two-Factor login expires (min: 1, max: 365).
two_factor_remember_days: i64, true, def, 30; 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 /// Disable authenticator time drifted codes to be valid |> Enabling this only allows the current TOTP code to be valid
@ -1211,8 +1211,8 @@ fn validate_config(cfg: &ConfigItems, on_update: bool) -> Result<(), Error> {
err!("`INVITATION_EXPIRATION_HOURS` has a minimum duration of 1 hour") err!("`INVITATION_EXPIRATION_HOURS` has a minimum duration of 1 hour")
} }
if !(1..=3650).contains(&cfg.two_factor_remember_days) { if !(1..=365).contains(&cfg.two_factor_remember_days) {
err!("`TWO_FACTOR_REMEMBER_DAYS` must be between 1 and 3650 days") err!("`TWO_FACTOR_REMEMBER_DAYS` must be between 1 and 365 days")
} }
// Validate schedule crontab format // Validate schedule crontab format

Loading…
Cancel
Save