From 2470099877e7faffc8ce83b73e9e7ccdb50b5c10 Mon Sep 17 00:00:00 2001 From: Roman Priesol Date: Mon, 23 Nov 2026 15:04:17 +0100 Subject: [PATCH] =?UTF-8?q?Login=20lasts=2090=20days=20instead=20of=20the?= =?UTF-8?q?=20browser=20session=20=E2=80=94=20Android=20dropped=20the=20se?= =?UTF-8?q?ssion=20cookie=20whenever=20it=20killed=20the=20browser/PWA,=20?= =?UTF-8?q?forcing=20a=20fresh=20Gitea=20login=20+=20MFA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app.rb b/app.rb index c3ddc02..9616a93 100644 --- a/app.rb +++ b/app.rb @@ -80,7 +80,12 @@ module Maptool # docs/deployment.adoc). Falls back to a random one so the app still # loads locally/in CI without it set; that fallback just means sessions # don't survive a restart there, which is fine outside production. + # expire_after: without it the cookie is a browser-session one, which + # Android drops whenever it kills the browser/PWA — a fresh Gitea + # login + MFA every time on the tablet. Counted from login (only the + # login paths write the cookie, see SkipSessionWrite). set :sessions, httponly: true, secure: production?, same_site: :lax, + expire_after: 90 * 24 * 3600, secret: ENV.fetch("SESSION_SECRET") { SecureRandom.hex(32) } use SkipSessionWrite