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.
This commit is contained in:
Maurice
2026-09-24 13:30:37 +02:00
parent 601ed66a38
commit 71913eb6e2
2 changed files with 5 additions and 2 deletions
@@ -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 () => {
+3 -1
View File
@@ -43,7 +43,9 @@ export function useLogin() {
const [username, setUsername] = useState<string>('')
const [email, setEmail] = useState<string>('')
const [password, setPassword] = useState<string>('')
const [rememberMe, setRememberMe] = useState<boolean>(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<boolean>(isNativeApp)
const [showPassword, setShowPassword] = useState<boolean>(false)
const [isLoading, setIsLoading] = useState<boolean>(false)
const [error, setError] = useState<string>('')