diff --git a/services/authelia.sh b/services/authelia.sh index caf37f5..3819ab4 100644 --- a/services/authelia.sh +++ b/services/authelia.sh @@ -2412,10 +2412,11 @@ _authelia_set_remember_me() { local config_file="$DOCKER_DIR/authelia/config/configuration.yml" [ -f "$config_file" ] || { log_warning "No configuration.yml found — install Authelia first."; return 1; } - local current + local current current_inactivity current="$(grep -E '^ remember_me:' "$config_file" | awk '{print $2}' | tr -d "'\"")" + current_inactivity="$(grep -E '^ inactivity:' "$config_file" | awk '{print $2}' | tr -d "'\"")" echo "" - echo " Current \"remember me\" duration: ${current:-not set}" + echo " Current \"remember me\" duration: ${current:-not set} (inactivity timeout: ${current_inactivity:-not set})" echo " How long a session lasts when someone checks \"Remember me\" at login —" echo " applies to every domain this Authelia instance protects. Also sets" echo " \"inactivity\" (idle timeout) to the same value, so a gap between visits" @@ -2424,10 +2425,22 @@ _authelia_set_remember_me() { echo " Examples: 12h, 7d, 1M (month), 1y. Set to -1 to disable Remember Me entirely." local new_duration="" prompt_text " New duration [${current:-7d}]:" "${current:-7d}" new_duration - if [ -z "$new_duration" ] || [ "$new_duration" = "$current" ]; then + if [ -z "$new_duration" ]; then log_info "No change made." return 0 fi + # Only truly a no-op if BOTH keys already match — remember_me alone + # matching isn't enough to skip, or an install still carrying the old + # mismatched inactivity default (from before this function synced the + # two) could never actually get inactivity fixed by re-entering the + # same remember_me value. Confirmed live: this is exactly what + # happened on a box that had already set remember_me: 1y before this + # sync existed — re-running with "1y" again hit this early return and + # left inactivity untouched. + if [ "$new_duration" = "$current" ] && [ "$new_duration" = "$current_inactivity" ]; then + log_info "No change made — remember_me and inactivity already both ${new_duration}." + return 0 + fi if grep -qE '^ remember_me:' "$config_file"; then sed -i "s/^ remember_me:.*/ remember_me: '${new_duration}'/" "$config_file"