From 71913eb6e22748baa6ea2ecf34243bf223825a1d Mon Sep 17 00:00:00 2001 From: Maurice Date: Thu, 24 Sep 2026 13:30:37 +0200 Subject: [PATCH] fix(native): remember the login by default inside the app With the switch off the app got a session cookie, which dies with the app process, so every time the phone unloaded TREK the user had to sign in again. Found while running the Android build in the emulator. --- client/src/pages/login/useLogin.native.test.tsx | 3 ++- client/src/pages/login/useLogin.ts | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/client/src/pages/login/useLogin.native.test.tsx b/client/src/pages/login/useLogin.native.test.tsx index 136f97353..61d36363a 100644 --- a/client/src/pages/login/useLogin.native.test.tsx +++ b/client/src/pages/login/useLogin.native.test.tsx @@ -66,10 +66,11 @@ afterEach(() => { }); describe('useLogin in the native app', () => { - it('FE-LOGIN-NATIVE-001: reports that it runs in the app', async () => { + it('FE-LOGIN-NATIVE-001: reports that it runs in the app and remembers the login by default', async () => { const { result } = renderLogin(); await waitFor(() => expect(result.current.appConfig).not.toBeNull()); expect(result.current.nativeApp).toBe(true); + expect(result.current.rememberMe).toBe(true); }); it('FE-LOGIN-NATIVE-002: does not bounce an OIDC-only install to the IdP inside the WebView', async () => { diff --git a/client/src/pages/login/useLogin.ts b/client/src/pages/login/useLogin.ts index 2fa48ed4e..bb914d42c 100644 --- a/client/src/pages/login/useLogin.ts +++ b/client/src/pages/login/useLogin.ts @@ -43,7 +43,9 @@ export function useLogin() { const [username, setUsername] = useState('') const [email, setEmail] = useState('') const [password, setPassword] = useState('') - const [rememberMe, setRememberMe] = useState(false) + // On by default in the app: a session cookie there dies with the app process, + // and nobody expects to sign in again every time the phone unloads an app. + const [rememberMe, setRememberMe] = useState(isNativeApp) const [showPassword, setShowPassword] = useState(false) const [isLoading, setIsLoading] = useState(false) const [error, setError] = useState('')