From 3cd9a1ece303ca69500ebd69c02094deca1e7eef Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 9 Sep 2026 13:19:18 +0000 Subject: [PATCH] Fix _authelia_set_remember_me skipping inactivity sync on a no-op remember_me The "already equal" early-exit compared only remember_me against the typed value, so re-entering an unchanged remember_me (the exact case for anyone who'd set it before the earlier fix existed) skipped the inactivity write entirely, leaving inactivity stuck at its old mismatched value. Now only skips when both keys already match the typed duration. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_0148pWopbt3tEKZWHYuHTb3c --- services/authelia.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) 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"